hgext/bookmarks.py
branchstable
changeset 13103 6e79a3bb8c79
parent 12881 161fe4879bfc
child 13104 5dac0d04b838
child 13306 146bad852ede
equal deleted inserted replaced
13102:2956945c3bee 13103:6e79a3bb8c79
    42 
    42 
    43     We also store a backup of the previous state in undo.bookmarks that
    43     We also store a backup of the previous state in undo.bookmarks that
    44     can be copied back on rollback.
    44     can be copied back on rollback.
    45     '''
    45     '''
    46     refs = repo._bookmarks
    46     refs = repo._bookmarks
    47     if os.path.exists(repo.join('bookmarks')):
    47 
    48         util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks'))
    48     try:
       
    49         bms = repo.opener('bookmarks').read()
       
    50     except IOError:
       
    51         bms = None
       
    52     if bms is not None:
       
    53         repo.opener('undo.bookmarks', 'w').write(bms)
       
    54 
    49     if repo._bookmarkcurrent not in refs:
    55     if repo._bookmarkcurrent not in refs:
    50         setcurrent(repo, None)
    56         setcurrent(repo, None)
    51     wlock = repo.wlock()
    57     wlock = repo.wlock()
    52     try:
    58     try:
    53         file = repo.opener('bookmarks', 'w', atomictemp=True)
    59         file = repo.opener('bookmarks', 'w', atomictemp=True)