Commits

Joel Rosdahl committed 8b81d1e

bookmarks: Only save undo.bookmarks if bookmarks exist

Otherwise the command will abort when there is no .hg/bookmarks file.

Comments (0)

Files changed (1)

hgext/bookmarks.py

     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))