# HG changeset patch # User David Soria Parra # Date 1296093528 -3600 # Node ID 7f2b8aac7bdcee5ca066aa02ac524497d15e41a4 # Parent 146bad852edef67c10e33fa11f94c493c1be7bab bookmarks: respect rollbacks dryrun parameter diff -r 146bad852ede -r 7f2b8aac7bdc hgext/bookmarks.py --- 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: diff -r 146bad852ede -r 7f2b8aac7bdc tests/test-bookmarks-strip.t --- 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 ..