mercurial/repair.py
changeset 34222 6193d810f7bb
parent 33725 86ea201eaeb9
child 34257 2844c4bd5a39
equal deleted inserted replaced
34221:8e0358024a36 34222:6193d810f7bb
    10 
    10 
    11 import errno
    11 import errno
    12 import hashlib
    12 import hashlib
    13 
    13 
    14 from .i18n import _
    14 from .i18n import _
    15 from .node import short
    15 from .node import (
       
    16     hex,
       
    17     short,
       
    18 )
    16 from . import (
    19 from . import (
    17     bundle2,
    20     bundle2,
    18     changegroup,
    21     changegroup,
    19     discovery,
    22     discovery,
    20     error,
    23     error,
    33         vfs.mkdir(backupdir)
    36         vfs.mkdir(backupdir)
    34 
    37 
    35     # Include a hash of all the nodes in the filename for uniqueness
    38     # Include a hash of all the nodes in the filename for uniqueness
    36     allcommits = repo.set('%ln::%ln', bases, heads)
    39     allcommits = repo.set('%ln::%ln', bases, heads)
    37     allhashes = sorted(c.hex() for c in allcommits)
    40     allhashes = sorted(c.hex() for c in allcommits)
    38     totalhash = hashlib.sha1(''.join(allhashes)).hexdigest()
    41     totalhash = hashlib.sha1(''.join(allhashes)).digest()
    39     name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
    42     name = "%s/%s-%s-%s.hg" % (backupdir, short(node),
       
    43                                hex(totalhash[:4]), suffix)
    40 
    44 
    41     cgversion = changegroup.safeversion(repo)
    45     cgversion = changegroup.safeversion(repo)
    42     comp = None
    46     comp = None
    43     if cgversion != '01':
    47     if cgversion != '01':
    44         bundletype = "HG20"
    48         bundletype = "HG20"