[PATCH] bookmarks: always write undo file

David Soria Parra dsp at php.net
Wed Jan 26 19:55:44 CST 2011


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1296093311 -3600
# Node ID 0e2659a6f29da230a39d955db8205669fd0d069a
# Parent  77351c88dd1098476c587d8fbf535963c42f809e
bookmarks: always write undo file

Always write the undo file. Otherwise, rollback will not work for
the initial bookmark as undo.bookmarks doesn't exists. In this case
undo.bookmarks needs already be empty.

diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
--- a/hgext/bookmarks.py
+++ b/hgext/bookmarks.py
@@ -48,9 +48,8 @@
     try:
         bms = repo.opener('bookmarks').read()
     except IOError:
-        bms = None
-    if bms is not None:
-        repo.opener('undo.bookmarks', 'w').write(bms)
+        bms = ''
+    repo.opener('undo.bookmarks', 'w').write(bms)
 
     if repo._bookmarkcurrent not in refs:
         setcurrent(repo, None)


More information about the Mercurial-devel mailing list