equal
deleted
inserted
replaced
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 __future__ import absolute_import |
9 from __future__ import absolute_import |
10 |
10 |
11 import errno |
11 import errno |
12 import hashlib |
|
13 |
12 |
14 from .i18n import _ |
13 from .i18n import _ |
15 from .node import ( |
14 from .node import ( |
16 hex, |
15 hex, |
17 short, |
16 short, |
27 pathutil, |
26 pathutil, |
28 phases, |
27 phases, |
29 pycompat, |
28 pycompat, |
30 util, |
29 util, |
31 ) |
30 ) |
32 from .utils import stringutil |
31 from .utils import ( |
|
32 hashutil, |
|
33 stringutil, |
|
34 ) |
33 |
35 |
34 |
36 |
35 def backupbundle( |
37 def backupbundle( |
36 repo, bases, heads, node, suffix, compress=True, obsolescence=True |
38 repo, bases, heads, node, suffix, compress=True, obsolescence=True |
37 ): |
39 ): |
43 vfs.mkdir(backupdir) |
45 vfs.mkdir(backupdir) |
44 |
46 |
45 # Include a hash of all the nodes in the filename for uniqueness |
47 # Include a hash of all the nodes in the filename for uniqueness |
46 allcommits = repo.set(b'%ln::%ln', bases, heads) |
48 allcommits = repo.set(b'%ln::%ln', bases, heads) |
47 allhashes = sorted(c.hex() for c in allcommits) |
49 allhashes = sorted(c.hex() for c in allcommits) |
48 totalhash = hashlib.sha1(b''.join(allhashes)).digest() |
50 totalhash = hashutil.sha1(b''.join(allhashes)).digest() |
49 name = b"%s/%s-%s-%s.hg" % ( |
51 name = b"%s/%s-%s-%s.hg" % ( |
50 backupdir, |
52 backupdir, |
51 short(node), |
53 short(node), |
52 hex(totalhash[:4]), |
54 hex(totalhash[:4]), |
53 suffix, |
55 suffix, |