Yuya Nishihara avatar Yuya Nishihara committed 07aa66e

update: have RepoWidget select bookmark by default

It seems more common to activate bookmark by update. In order to update to
revision with no bookmark, they can select revision number from combo box.

Comments (0)

Files changed (1)

tortoisehg/hgqt/repowidget.py

             dlg.deleteLater()
 
     def updateToRevision(self):
-        dlg = update.UpdateDialog(self.repo, self.rev, self)
+        ctx = self.repo[self.rev]
+        bookmarks = ctx.bookmarks()
+        if ctx in self.repo.parents():
+            # keep bookmark unchanged when updating to current rev
+            if self.repo._bookmarkcurrent in bookmarks:
+                rev = self.repo._bookmarkcurrent
+            else:
+                rev = self.rev
+        else:
+            # more common switching bookmark, rather than deselecting it
+            if bookmarks:
+                rev = bookmarks[0]
+            else:
+                rev = self.rev
+
+        dlg = update.UpdateDialog(self.repo, rev, self)
         dlg.output.connect(self.output)
         dlg.makeLogVisible.connect(self.makeLogVisible)
         dlg.progress.connect(self.progress)
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.