Mercurial > hg
changeset 7253:8b81d1e2dc04
bookmarks: Only save undo.bookmarks if bookmarks exist
Otherwise the command will abort when there is no .hg/bookmarks file.
author | Joel Rosdahl <joel@rosdahl.net> |
---|---|
date | Sat, 25 Oct 2008 19:05:52 +0200 |
parents | 104a8324798e |
children | d892211d670e |
files | hgext/bookmarks.py |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/bookmarks.py Sat Oct 25 19:05:42 2008 +0200 +++ b/hgext/bookmarks.py Sat Oct 25 19:05:52 2008 +0200 @@ -52,7 +52,8 @@ 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))