Commits

Yuya Nishihara committed 0bb1674

workbench: apply selected url before running sync operation from toolbar

Comments (0)

Files changed (2)

tortoisehg/hgqt/repowidget.py

         self.repoview.saveSettings(s)
         return True
 
+    def setSyncUrl(self, url):
+        """Change the current peer-repo url of the sync widget; url may be
+        a symbolic name defined in [paths] section"""
+        self.syncDemand.get().setUrl(url)
+
     def incoming(self):
         self.syncDemand.get().incoming()
 

tortoisehg/hgqt/workbench.py

             else:
                 self.urlCombo.addItem(a, (a, a))
 
+    def _syncUrlFor(self, op):
+        """Current URL alias for the given sync operation"""
+        index = {'incoming': 0, 'pull': 0, 'outgoing': 1, 'push': 1}[op]
+        data = self.urlCombo.itemData(self.urlCombo.currentIndex())
+        return data.toPyObject()[index]
+
     def _setupCustomTools(self, ui):
         tools, toollist = hglib.tortoisehgtools(ui,
             selectedlocation='workbench.custom-toolbar')
         w = self.repoTabsWidget.currentWidget()
         if w:
             op = str(action.data().toString())
+            w.setSyncUrl(self._syncUrlFor(op))
             getattr(w, op)()
 
     def serve(self):
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.