Mercurial > hg
changeset 13307:7f2b8aac7bdc stable
bookmarks: respect rollbacks dryrun parameter
author | David Soria Parra <dsp@php.net> |
---|---|
date | Thu, 27 Jan 2011 02:58:48 +0100 |
parents | 146bad852ede |
children | 9f188734dbb0 |
files | hgext/bookmarks.py tests/test-bookmarks-strip.t |
diffstat | 2 files changed, 20 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/bookmarks.py Thu Jan 27 02:55:11 2011 +0100 +++ b/hgext/bookmarks.py Thu Jan 27 02:58:48 2011 +0100 @@ -261,10 +261,14 @@ 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:
--- a/tests/test-bookmarks-strip.t Thu Jan 27 02:55:11 2011 +0100 +++ b/tests/test-bookmarks-strip.t Thu Jan 27 02:58:48 2011 +0100 @@ -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 @@ $ hg bookmarks markb $ hg bookmarks * markb 0:07f494440405 + +rollback dry run with rollback information + + $ hg rollback -n + $ hg bookmarks + * markb 0:07f494440405 + $ cd ..