Anonymous avatar Anonymous committed e27dd73

synch: activate target revision option

Appearred to have been completely ignored since creation.
Refactored handling of advanced options along the way.

Comments (0)

Files changed (1)

             tbutton.set_tooltip(self.tips, tip)
         tbutton.connect('clicked', handler, userdata)
         return tbutton
+
+    def _get_advanced_options(self):
+        opts = {}
+        if self._showpatch.get_active():
+            opts['patch'] = ['--patch']
+        if self._nomerge.get_active():
+            opts['no-merges'] = ['--no-merges']
+        if self._force.get_active():
+            opts['force'] = ['--force']
+        if self._newestfirst.get_active():
+            opts['newest-first'] = ['--newest-first']
+        target_rev = self._reventry.get_text().strip()
+        if target_rev != "":
+            opts['rev'] = ['--rev', target_rev]
+            
+        return opts
         
     def _pull_clicked(self, toolbutton, data=None):
+        aopts = self._get_advanced_options()
         if self._pull_fetch.get_active():
             cmd = ['fetch', '--message', 'merge']
         else:
             cmd = ['pull']
+            cmd += aopts.get('force', [])
             if self._pull_update.get_active():
                 cmd.append('--update')
-            if self._force.get_active():
-                cmd.append('--force')
+        cmd += aopts.get('rev', [])
         self._exec_cmd(cmd)
     
     def _push_clicked(self, toolbutton, data=None):
+        aopts = self._get_advanced_options()
         cmd = ['push']
-        if self._force.get_active():
-            cmd.append('--force')
+        cmd += aopts.get('rev', [])
+        cmd += aopts.get('force', [])
         self._exec_cmd(cmd)
         
     def _conf_clicked(self, toolbutton, data=None):
         dlg.set_transient_for(None)
 
     def _incoming_clicked(self, toolbutton, data=None):
+        aopts = self._get_advanced_options()
         cmd = ['incoming']
-        if self._showpatch.get_active():
-            cmd.append('--patch')
-        if self._nomerge.get_active():
-            cmd.append('--no-merges')
-        if self._force.get_active():
-            cmd.append('--force')
-        if self._newestfirst.get_active():
-            cmd.append('--newest-first')
+        cmd += aopts.get('rev', [])
+        cmd += aopts.get('patch', [])
+        cmd += aopts.get('no-merges', [])
+        cmd += aopts.get('force', [])
+        cmd += aopts.get('newest-first', [])
         self._exec_cmd(cmd)
         
     def _outgoing_clicked(self, toolbutton, data=None):
+        aopts = self._get_advanced_options()
         cmd = ['outgoing']
-        if self._showpatch.get_active():
-            cmd.append('--patch')
-        if self._nomerge.get_active():
-            cmd.append('--no-merges')
-        if self._force.get_active():
-            cmd.append('--force')
-        if self._newestfirst.get_active():
-            cmd.append('--newest-first')
+        cmd += aopts.get('rev', [])
+        cmd += aopts.get('patch', [])
+        cmd += aopts.get('no-merges', [])
+        cmd += aopts.get('force', [])
+        cmd += aopts.get('newest-first', [])
         self._exec_cmd(cmd)
         
     def _stop_clicked(self, toolbutton, data=None):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.