# HG changeset patch # User Joel Rosdahl # Date 2008-10-25 17:05:52 # Node ID 8b81d1e2dc04e34206965836fee3edd4d6ff8ef6 # Parent 104a8324798ec962804308c01fbb08fe2bd5797b bookmarks: Only save undo.bookmarks if bookmarks exist Otherwise the command will abort when there is no .hg/bookmarks file. diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py --- a/hgext/bookmarks.py +++ b/hgext/bookmarks.py @@ -52,7 +52,8 @@ def write(repo, refs): We also store a backup of the previous state in undo.bookmarks that can be copied back on rollback. ''' - util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks')) + if os.path.exists(repo.join('bookmarks')): + util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks')) file = repo.opener('bookmarks', 'w+') for refspec, node in refs.items(): file.write("%s %s\n" % (hex(node), refspec))