hgext/journal.py
changeset 47012 d55b71393907
parent 46113 59fa3890d40a
child 48875 6000f5b25c9b
equal deleted inserted replaced
46992:5fa019ceb499 47012:d55b71393907
    20 
    20 
    21 from mercurial.i18n import _
    21 from mercurial.i18n import _
    22 from mercurial.node import (
    22 from mercurial.node import (
    23     bin,
    23     bin,
    24     hex,
    24     hex,
    25     nullid,
       
    26 )
    25 )
    27 
    26 
    28 from mercurial import (
    27 from mercurial import (
    29     bookmarks,
    28     bookmarks,
    30     cmdutil,
    29     cmdutil,
   115     """Records all dirstate parent changes in the journal."""
   114     """Records all dirstate parent changes in the journal."""
   116     old = list(old)
   115     old = list(old)
   117     new = list(new)
   116     new = list(new)
   118     if util.safehasattr(dirstate, 'journalstorage'):
   117     if util.safehasattr(dirstate, 'journalstorage'):
   119         # only record two hashes if there was a merge
   118         # only record two hashes if there was a merge
   120         oldhashes = old[:1] if old[1] == nullid else old
   119         oldhashes = old[:1] if old[1] == dirstate._nodeconstants.nullid else old
   121         newhashes = new[:1] if new[1] == nullid else new
   120         newhashes = new[:1] if new[1] == dirstate._nodeconstants.nullid else new
   122         dirstate.journalstorage.record(
   121         dirstate.journalstorage.record(
   123             wdirparenttype, b'.', oldhashes, newhashes
   122             wdirparenttype, b'.', oldhashes, newhashes
   124         )
   123         )
   125 
   124 
   126 
   125 
   129     """Records all bookmark changes in the journal."""
   128     """Records all bookmark changes in the journal."""
   130     repo = store._repo
   129     repo = store._repo
   131     if util.safehasattr(repo, 'journal'):
   130     if util.safehasattr(repo, 'journal'):
   132         oldmarks = bookmarks.bmstore(repo)
   131         oldmarks = bookmarks.bmstore(repo)
   133         for mark, value in pycompat.iteritems(store):
   132         for mark, value in pycompat.iteritems(store):
   134             oldvalue = oldmarks.get(mark, nullid)
   133             oldvalue = oldmarks.get(mark, repo.nullid)
   135             if value != oldvalue:
   134             if value != oldvalue:
   136                 repo.journal.record(bookmarktype, mark, oldvalue, value)
   135                 repo.journal.record(bookmarktype, mark, oldvalue, value)
   137     return orig(store, fp)
   136     return orig(store, fp)
   138 
   137 
   139 
   138