def OnRevert(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     commit = self.combo_box_4.GetValue()
     
     """ Revert to commit """
     obj=FileController(self.directory)
     obj.revert(commit)
     self.sb.SetStatusText("Reverted successfully")
 def gotCommitsContent(self,cont,commits,mycommits):
      obj=FileController(os.getcwd())
      obj.uncompressAndWrite(cont)
      common_commit=[x for x in commits if x in set(mycommits)]
      #print getLastCommit(common_commit),"\n"
      #print (parent_commit.split()[1])
      parent_file_list=obj.getFileList(getLastCommit(common_commit))
      my_file_list=obj.getFileList(getLastCommit(mycommits))
      #print my_file_list,"\n"
      other_file_list=obj.getFileList(getLastCommit(commits))
      #print other_file_list,"\n"
      flag=0
      for elem in my_file_list:
              for temp in other_file_list:
                      if(elem[0]==temp[0]):
                              dicts=merge3.devilMerge(obj.getFile(getLastCommit(common_commit),elem[0]),obj.getFile(getLastCommit(mycommits),elem[0]),obj.getFile(getLastCommit(commits),elem[0]))
                              #print dicts
                              #reactor.stop()
                              
                              print "opening file ",elem[0]
                              files=open(elem[0],'w')
                              files.write(dicts['md_content'])
                              files.close()
                              
                              if(dicts['conflict']==0 and dicts['merged']!=0):
                                      print("Merged "+elem[0]+"\n")
                              else:
                                      print("Merged with conflicts in "+elem[0]+" not commiting.Please commit after manually changing")
                                      flag=1
      if(flag==0):
              obj.commit('auto-merged successfull')
      reactor.stop()
Exemple #3
0
 def remote_push(self, directory, loc):
     print loc, "\n"
     print directory
     print "received push request"
     f = FileController(directory)
     f.pull(loc, False)
     print "pull completed"
     return 1
Exemple #4
0
 def OnInit(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     """ Init the Repo on current directory """
     obj = FileController(self.directory)
     #print "Init called"
     username = self.text_ctrl_6.GetValue()
     email = self.text_ctrl_7.GetValue()
     obj.start2(username, email)
     self.sb.SetStatusText("Repo Initialized")
 def OnPull(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     server = self.combo_box_5.GetValue()
     loc=self.remote[server]
     """ Pull """
     obj=FileController(self.directory)
     obj.pull(loc)
     reactor.run()
     self.sb.SetStatusText("Pulled successfully")
 def OnInit(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     """ Init the Repo on current directory """
     obj=FileController(self.directory)
     #print "Init called"
     username = self.text_ctrl_6.GetValue()
     email = self.text_ctrl_7.GetValue()
     obj.start2(username,email)
     self.sb.SetStatusText("Repo Initialized")
Exemple #7
0
 def OnPull(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     server = self.combo_box_5.GetValue()
     loc = self.remote[server]
     """ Pull """
     obj = FileController(self.directory)
     obj.pull(loc)
     reactor.run()
     self.sb.SetStatusText("Pulled successfully")
 def remote_push(self,directory,loc):
     print loc,"\n"
     print directory
     print "received push request"
     f = FileController(directory)
     f.pull(loc,False)
     print "pull completed"
     return 1
    def OnCommit(self, event):  # wxGlade: DevilMainFrame.<event_handler>
        msg = self.text_ctrl_2.GetValue()
        """ Commit code here using commit message as msg"""
        obj=FileController(self.directory)
        obj.commit(msg)
        #print msg

        # Update commit list in dialog box 
        self.UpdateRevertList()
        self.sb.SetStatusText("Commited successfully ")
Exemple #10
0
    def OnCommit(self, event):  # wxGlade: DevilMainFrame.<event_handler>
        msg = self.text_ctrl_2.GetValue()
        """ Commit code here using commit message as msg"""
        obj = FileController(self.directory)
        obj.commit(msg)
        #print msg

        # Update commit list in dialog box
        self.UpdateRevertList()
        self.sb.SetStatusText("Commited successfully ")
Exemple #11
0
 def OnPush(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     myloc = self.text_ctrl_3.GetValue()
     server = self.combo_box_6.GetValue()
     loc = self.remote[server]
     """ Push """
     print self.directory, "\n"
     obj = FileController(self.directory)
     print myloc + loc, "\n"
     obj.push(myloc + loc)
     reactor.run()
     self.sb.SetStatusText("Pushed successfully")
 def OnPush(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     myloc = self.text_ctrl_3.GetValue()
     server = self.combo_box_6.GetValue()
     loc=self.remote[server]
     """ Push """
     print self.directory,"\n"
     obj=FileController(self.directory)
     print myloc+loc,"\n"
     obj.push(myloc+loc)
     reactor.run()
     self.sb.SetStatusText("Pushed successfully")
Exemple #13
0
 def OnAdd(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     """ Open a file"""
     dlg = wx.FileDialog(self, "Choose a file", '.', "", "*.*", wx.OPEN)
     if dlg.ShowModal() == wx.ID_OK:
         fn = dlg.GetFilename()
         dirname = dlg.GetDirectory()
         filename = os.path.join(dirname, fn)
         self.label_4.SetLabel(filename)
         wx.Yield()
         """ Add Code Here using """
         obj = FileController(self.directory)
         obj.add(filename)
         #print filename
     dlg.Destroy()
     self.sb.SetStatusText("File added successfully")
 def OnAdd(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     """ Open a file"""
     dlg = wx.FileDialog(self, "Choose a file", '.', "", "*.*", wx.OPEN)
     if dlg.ShowModal() == wx.ID_OK:
         fn = dlg.GetFilename()
         dirname = dlg.GetDirectory()
         filename = os.path.join(dirname, fn)
         self.label_4.SetLabel(filename)
         wx.Yield()
         """ Add Code Here using """
         obj=FileController(self.directory)
         obj.add(filename)
         #print filename
     dlg.Destroy()
     self.sb.SetStatusText("File added successfully")
Exemple #15
0
    def __init__(self, session, path=""):
        BaseController.__init__(self, path)
        self.session = session
        piconpath = getPiconPath()

        self.putChild("web", WebController(session))
        self.putChild("api", ApiController(session))
        self.putChild("ajax", AjaxController(session))
        self.putChild("file", FileController(session))
        self.putChild("grab", grabScreenshot(session))
        self.putChild("mobile", MobileController(session))
        self.putChild("js", static.File(getPublicPath() + "/js"))
        self.putChild("css", static.File(getPublicPath() + "/css"))
        self.putChild("static", static.File(getPublicPath() + "/static"))
        self.putChild("images", static.File(getPublicPath() + "/images"))
        self.putChild("ipkg", IpkgController(session))
        self.putChild("autotimer", ATController(session))
        self.putChild("serienrecorder", SRController(session))
        self.putChild("epgrefresh", ERController(session))
        self.putChild("bouqueteditor", BQEController(session))
        self.putChild("transcoding", TranscodingController(session))
        self.putChild("wol", WOLClientController(session))
        self.putChild("wolsetup", WOLSetupController(session))
        if piconpath:
            self.putChild("picon", static.File(piconpath))
Exemple #16
0
	def __init__(self, session, path=""):
		BaseController.__init__(self, path=path, session=session)

		self.putChild("web", WebController(session))
		self.putGZChild("api", ApiController(session))
		self.putGZChild("ajax", AjaxController(session))
		self.putChild("file", FileController())
		self.putChild("grab", grabScreenshot(session))
		if os.path.exists(getPublicPath('mobile')):
			self.putChild("mobile", MobileController(session))
			self.putChild("m", static.File(getPublicPath() + "/mobile"))
		for static_val in ('js', 'css', 'static', 'images', 'fonts'):
			self.putChild(static_val, static.File(getPublicPath() + '/' + static_val))
		for static_val in ('themes', 'webtv', 'vxg'):
			if os.path.exists(getPublicPath(static_val)):
				self.putChild(static_val, static.File(getPublicPath() + '/' + static_val))

		if os.path.exists('/usr/bin/shellinaboxd'):
			self.putChild("terminal", proxy.ReverseProxyResource('::1', 4200, '/'))
		self.putGZChild("ipkg", IpkgController(session))
		self.putChild("autotimer", ATController(session))
		self.putChild("epgrefresh", ERController(session))
		self.putChild("bouqueteditor", BQEController(session))
		self.putChild("transcoding", TranscodingController())
		self.putChild("wol", WOLClientController())
		self.putChild("wolsetup", WOLSetupController(session))
		if PICON_PATH:
			self.putChild("picon", static.File(PICON_PATH))
		try:
			from NET import NetController
			self.putChild("net", NetController(session))
		except:
			pass
Exemple #17
0
 def OnSaveRemote(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     fp = FileController(self.directory)
     w = self.text_ctrl_1.GetValue()
     y = open(fp.remotefile, 'w')
     y.write(w)
     y.close()
     self.UpdateServerList()
     self.sb.SetStatusText("Saved successfully")
 def gotCommits(self,commits):
      obj=FileController(os.getcwd())
      mycommits = obj.getAllCommits()
      print commits,"\n"
      print mycommits,"\n"
      commits_to_fetch = set(commits).difference(set(mycommits))
      fp = open(obj.statusfile,'a')
      for k in commits_to_fetch:
          fp.write(k)
      fp.close()
      c_to_fetch = [i.split()[1] for i in commits_to_fetch]
      print c_to_fetch
      if c_to_fetch == []:
              reactor.stop()
      else:
              d=self.result.callRemote("getCommitContent","../devil2",c_to_fetch)
              d.addCallback(self.gotCommitsContent,commits,mycommits)
Exemple #19
0
 def UpdateRevertList(self):
     """ Get all commits in the commit list """
     fp = FileController(self.directory)
     try:
         files = open(fp.statusfile)
         lines = files.readlines()
         commits = [l[1] for l in (m.split() for m in lines)]
         self.combo_box_4.Clear()
         self.combo_box_4.AppendItems(commits)
         wx.Yield()
     except:
         print "No status file"
Exemple #20
0
    def OnLog(self, event):  # wxGlade: DevilMainFrame.<event_handler>
        obj = FileController(self.directory)
        status = ''
        files = open(obj.statusfile)
        lines = files.readlines()
        for line in lines:
            line = line.split()
            status = status + "Commit: " + line[1] + "\n" + "Author: " + line[
                2] + "\n" + "Email: " + line[3] + "\n" + "Date: " + line[
                    4] + "\nMsg: " + ' '.join(line[6:]) + "\n\n"

        self.text_ctrl_5.SetValue(status)
    def __init__(self, session, path=""):
        BaseController.__init__(self, path)
        self.session = session
        piconpath = getPiconPath()

        self.putChild("web", WebController(session))
        self.putChild("api", ApiController(session))
        self.putChild("ajax", AjaxController(session))
        self.putChild("file", FileController(session))
        self.putChild("grab", grabScreenshot(session))
        self.putChild("mobile", MobileController(session))
        self.putChild("js", static.File(getPublicPath() + "/js"))
        self.putChild("css", static.File(getPublicPath() + "/css"))
        self.putChild("images", static.File(getPublicPath() + "/images"))
        if piconpath:
            self.putChild("picon", static.File(piconpath))
Exemple #22
0
 def UpdateServerList(self):
     """ get list of servers """
     try:
         cp = ConfigParser.RawConfigParser()
         fp = FileController(self.directory)
         cp.read(fp.remotefile)
         nodes = cp.items("Remotes")
         servers = []
         for (n, l) in nodes:
             self.remote[n] = l
             servers = servers + [n]
         self.combo_box_5.Clear()
         self.combo_box_5.AppendItems(servers)
         self.combo_box_6.Clear()
         self.combo_box_6.AppendItems(servers)
         wx.Yield()
     except:
         print "failed updating server list"
Exemple #23
0
    def OnStatus(self, event):  # wxGlade: DevilMainFrame.<event_handler>
        """ Status code here """
        obj = FileController(self.directory)
        files = open(obj.trackingfile)
        lines = files.readlines()
        print lines
        #splitted = [(l[0],l[1],l[2]) for l in (y.split() for y in lines)]
        status = ''
        for line in lines:
            #for (f,st,md) in splitted:
            sp = line.split()
            print sp
            f = sp[0]
            st = sp[1]
            md = sp[2]
            if st != 'commited':
                status = status + "added: " + f + "\n"
            elif not (md == str(os.path.getmtime(f))):
                status = status + "modified: " + f + "\n"
        #status = "get status from file"

        self.text_ctrl_5.SetValue(status)
    def __init__(self, session, path=""):
        BaseController.__init__(self, path=path, session=session)
        piconpath = getPiconPath()

        self.putChild("web", WebController(session))
        self.putChild("api", ApiController(session))
        self.putChild("ajax", AjaxController(session))
        self.putChild("file", FileController())
        self.putChild("grab", grabScreenshot(session))
        if os.path.exists(getPublicPath('mobile')):
            self.putChild("mobile", MobileController(session))
            self.putChild("m", static.File(getPublicPath() + "/mobile"))
        self.putChild("js", static.File(getPublicPath() + "/js"))
        self.putChild("css", static.File(getPublicPath() + "/css"))
        self.putChild("static", static.File(getPublicPath() + "/static"))
        self.putChild("images", static.File(getPublicPath() + "/images"))
        self.putChild("fonts", static.File(getPublicPath() + "/fonts"))
        if os.path.exists(getPublicPath('themes')):
            self.putChild("themes", static.File(getPublicPath() + "/themes"))
        if os.path.exists(getPublicPath('webtv')):
            self.putChild("webtv", static.File(getPublicPath() + "/webtv"))
        if os.path.exists(getPublicPath('vxg')):
            self.putChild("vxg", static.File(getPublicPath() + "/vxg"))
        if os.path.exists('/usr/bin/shellinaboxd'):
            self.putChild("terminal",
                          proxy.ReverseProxyResource('::1', 4200, '/'))
        self.putChild("ipkg", IpkgController(session))
        self.putChild("autotimer", ATController(session))
        self.putChild("serienrecorder", SRController(session))
        self.putChild("epgrefresh", ERController(session))
        self.putChild("bouqueteditor", BQEController(session))
        self.putChild("transcoding", TranscodingController())
        self.putChild("wol", WOLClientController())
        self.putChild("wolsetup", WOLSetupController(session))
        if piconpath:
            self.putChild("picon", static.File(piconpath))
Exemple #25
0
 def remote_getCommits(self, directory):
     f = FileController(directory)
     return f.getAllCommits()
 def remote_getCommits(self,directory):
     f = FileController(directory)
     return f.getAllCommits()
Exemple #27
0
 def remote_getCommitContent(self, directory, commit):
     f = FileController(directory)
     return f.compressAndSend(commit)
 def remote_getCommitContent(self,directory,commit):
     f = FileController(directory)
     return f.compressAndSend(commit)
Exemple #29
0
 def OnRevert(self, event):  # wxGlade: DevilMainFrame.<event_handler>
     commit = self.combo_box_4.GetValue()
     """ Revert to commit """
     obj = FileController(self.directory)
     obj.revert(commit)
     self.sb.SetStatusText("Reverted successfully")
Exemple #30
0
    def __init__(self, *args, **kwds):
        self.directory = os.getcwd()
        fp = FileController(self.directory)
        try:
            y = open(fp.remotefile)
            remotecontent = y.read()
            y.close()
        except:
            remotecontent = ""
            print "No remote file"
        self.remote = {}
        # begin wxGlade: DevilMainFrame.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.notebook_1 = wx.Notebook(self, -1, style=0)
        self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1)
        self.text_ctrl_6 = wx.TextCtrl(self.notebook_1_pane_1, -1, "Username")
        self.text_ctrl_7 = wx.TextCtrl(self.notebook_1_pane_1, -1, "email")
        self.button_13 = wx.Button(self.notebook_1_pane_1, -1, "Initiate Repo")
        self.label_4 = wx.StaticText(self.notebook_1_pane_1, -1,
                                     "Add File or Directory")
        self.button_1 = wx.Button(self.notebook_1_pane_1, -1, "Add")
        self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_pane_1,
                                       -1,
                                       "Enter the commit to revert to. ",
                                       style=wx.TE_MULTILINE | wx.TE_LINEWRAP)
        self.button_6 = wx.Button(self.notebook_1_pane_1, -1, "Commit")
        self.combo_box_4 = wx.ComboBox(self.notebook_1_pane_1,
                                       -1,
                                       choices=[],
                                       style=wx.CB_DROPDOWN | wx.CB_DROPDOWN
                                       | wx.CB_READONLY)
        self.button_7 = wx.Button(self.notebook_1_pane_1, -1, "Revert")
        self.combo_box_5 = wx.ComboBox(self.notebook_1_pane_1,
                                       -1,
                                       choices=[],
                                       style=wx.CB_DROPDOWN | wx.CB_DROPDOWN
                                       | wx.CB_READONLY)
        self.button_8 = wx.Button(self.notebook_1_pane_1, -1, "Pull")
        self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_pane_1, -1,
                                       "localhost:7000")
        self.combo_box_6 = wx.ComboBox(self.notebook_1_pane_1,
                                       -1,
                                       choices=[],
                                       style=wx.CB_DROPDOWN | wx.CB_DROPDOWN
                                       | wx.CB_READONLY)
        self.button_9 = wx.Button(self.notebook_1_pane_1, -1, "Push")
        self.notebook_1_pane_2 = wx.Panel(self.notebook_1, -1)
        self.button_11 = wx.Button(self.notebook_1_pane_2, -1, "Status")
        self.button_12 = wx.Button(self.notebook_1_pane_2, -1, "Log")
        self.text_ctrl_5 = wx.TextCtrl(self.notebook_1_pane_2,
                                       -1,
                                       "",
                                       style=wx.TE_MULTILINE | wx.TE_READONLY
                                       | wx.TE_LINEWRAP)
        self.notebook_1_pane_3 = wx.Panel(self.notebook_1, -1)
        self.button_2 = wx.Button(self.notebook_1_pane_3, -1, "save")
        self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_pane_3,
                                       -1,
                                       remotecontent,
                                       style=wx.TE_MULTILINE | wx.TE_LINEWRAP)

        self.sb = self.CreateStatusBar()

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.OnInit, self.button_13)
        self.Bind(wx.EVT_BUTTON, self.OnAdd, self.button_1)
        self.Bind(wx.EVT_BUTTON, self.OnCommit, self.button_6)
        self.Bind(wx.EVT_BUTTON, self.OnRevert, self.button_7)
        self.Bind(wx.EVT_BUTTON, self.OnPull, self.button_8)
        self.Bind(wx.EVT_BUTTON, self.OnPush, self.button_9)
        self.Bind(wx.EVT_BUTTON, self.OnStatus, self.button_11)
        self.Bind(wx.EVT_BUTTON, self.OnLog, self.button_12)
        self.Bind(wx.EVT_BUTTON, self.OnSaveRemote, self.button_2)
        # end wxGlade
        self.UpdateRevertList()
        self.UpdateServerList()
 def got_connected(self,result):
      self.result=result
      obj=FileController(os.getcwd())
      d=result.callRemote("getCommits","../devil2")
      d.addCallback(self.gotCommits)