comparison mercurial/repair.py @ 25340:28800ab40395

repair: use _hexlist() to build revset expression from binary nodes _hexlist() should be efficient than _list().
author Yuya Nishihara <yuya@tcha.org>
date Sun, 24 May 2015 14:34:12 +0900
parents 678d0bfdd31a
children ff955e7b1085
comparison
equal deleted inserted replaced
25339:c50655b9c856 25340:28800ab40395
5 # 5 #
6 # This software may be used and distributed according to the terms of the 6 # This software may be used and distributed according to the terms of the
7 # GNU General Public License version 2 or any later version. 7 # GNU General Public License version 2 or any later version.
8 8
9 from mercurial import changegroup, exchange, util, bundle2 9 from mercurial import changegroup, exchange, util, bundle2
10 from mercurial.node import short, hex 10 from mercurial.node import short
11 from mercurial.i18n import _ 11 from mercurial.i18n import _
12 import errno 12 import errno
13 13
14 def _bundle(repo, bases, heads, node, suffix, compress=True): 14 def _bundle(repo, bases, heads, node, suffix, compress=True):
15 """create a bundle with the specified revisions as a backup""" 15 """create a bundle with the specified revisions as a backup"""
32 vfs = repo.vfs 32 vfs = repo.vfs
33 if not vfs.isdir(backupdir): 33 if not vfs.isdir(backupdir):
34 vfs.mkdir(backupdir) 34 vfs.mkdir(backupdir)
35 35
36 # Include a hash of all the nodes in the filename for uniqueness 36 # Include a hash of all the nodes in the filename for uniqueness
37 hexbases = (hex(n) for n in bases) 37 allcommits = repo.set('%ln::%ln', bases, heads)
38 hexheads = (hex(n) for n in heads)
39 allcommits = repo.set('%ls::%ls', hexbases, hexheads)
40 allhashes = sorted(c.hex() for c in allcommits) 38 allhashes = sorted(c.hex() for c in allcommits)
41 totalhash = util.sha1(''.join(allhashes)).hexdigest() 39 totalhash = util.sha1(''.join(allhashes)).hexdigest()
42 name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix) 40 name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
43 41
44 if usebundle2: 42 if usebundle2: