bookmarks: respect rollbacks dryrun parameter

This commit is contained in:
David Soria Parra 2011-01-27 02:58:48 +01:00
parent e5aec633d1
commit a4bbbca72d
2 changed files with 20 additions and 3 deletions

View File

@ -261,10 +261,14 @@ def reposetup(ui, repo):
file.close()
return mark
def rollback(self, *args):
def rollback(self, dryrun=False):
if os.path.exists(self.join('undo.bookmarks')):
util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
return super(bookmark_repo, self).rollback(*args)
if not dryrun:
util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
elif not os.path.exists(self.sjoin("undo")):
# avoid "no rollback information available" message
return 0
return super(bookmark_repo, self).rollback(dryrun)
def lookup(self, key):
if key in self._bookmarks:

View File

@ -6,6 +6,12 @@
$ echo qqq>qqq.txt
rollback dry run without rollback information
$ hg rollback
no rollback information available
[1]
add file
$ hg add
@ -83,5 +89,12 @@ can you be added again?
$ hg bookmarks markb
$ hg bookmarks
* markb 0:07f494440405
rollback dry run with rollback information
$ hg rollback -n
$ hg bookmarks
* markb 0:07f494440405
$ cd ..