# HG changeset patch
# User Angel Ezquerra <
angel.e...@gmail.com>
# Date 1369089117 -7200
# Tue May 21 00:31:57 2013 +0200
# Branch stable
# Node ID ea55ab0edbcbbab1ee9243524087f059812c8b6e
# Parent 7b0dd1c0875c08fcfb5b93ada58957cabf961ed7
bookmarks: prompt to activate new/moved bookmarks on current rev (fixes #2605)
diff --git a/tortoisehg/hgqt/bookmark.py b/tortoisehg/hgqt/bookmark.py
--- a/tortoisehg/hgqt/bookmark.py
+++ b/tortoisehg/hgqt/bookmark.py
@@ -162,7 +162,10 @@
return
def finished():
- self.set_status(_("Bookmark '%s' has been added") % bookmark, True)
+ self._bookmark_action_finished(
+ _("Bookmark '%s' has been added") % bookmark,
+ bookmark,
+ activate_prompt=True)
cmdline = ['bookmarks', '--repository', self.repo.root,
'--rev', str(self.rev), bookmarklocal]
@@ -178,7 +181,10 @@
return
def finished():
- self.set_status(_("Bookmark '%s' has been moved") % bookmark, True)
+ self._bookmark_action_finished(
+ _("Bookmark '%s' has been moved") % bookmark,
+ bookmark,
+ activate_prompt=True)
cmdline = ['bookmarks', '--repository', self.repo.root,
'--rev', str(self.rev), '--force', bookmarklocal]
@@ -224,6 +230,21 @@
self.cmd.run(cmdline)
self.finishfunc = finished
+ def _bookmark_activated(self, bookmark):
+ self.set_status(_('bookmark "%s" activated') % bookmark, True)
+
+ def _bookmark_action_finished(self, msg, ubookmark, activate_prompt=False):
+ self.set_status(msg, True)
+ if activate_prompt and self.rev == self.repo['.'].rev():
+ if qtlib.QuestionMsgBox(_('Activate bookmark?'),
+ _('Do you want to activate the "%s" bookmark?') \
+ % ubookmark, parent=self):
+ bookmark = hglib.fromunicode(ubookmark)
+ cmdline = ['update', '--repository', self.repo.root,
+ '--rev', bookmark]
+ self.cmd.run(cmdline)
+ self.finishfunc = lambda: self._bookmark_activated(bookmark)
+
def reject(self):
# prevent signals from reaching deleted objects
self.repo.repositoryChanged.disconnect(self.refresh)