Show More
@@ -5,9 +5,9 b'' | |||||
5 | from __future__ import absolute_import, print_function |
|
5 | from __future__ import absolute_import, print_function | |
6 |
|
6 | |||
7 | import sys |
|
7 | import sys | |
|
8 | from mercurial.node import hex | |||
8 | from mercurial import ( |
|
9 | from mercurial import ( | |
9 | encoding, |
|
10 | encoding, | |
10 | node, |
|
|||
11 | pycompat, |
|
11 | pycompat, | |
12 | revlog, |
|
12 | revlog, | |
13 | ) |
|
13 | ) | |
@@ -38,9 +38,9 b' for f in sys.argv[1:]:' | |||||
38 | n = r.node(i) |
|
38 | n = r.node(i) | |
39 | p = r.parents(n) |
|
39 | p = r.parents(n) | |
40 | d = r.revision(n) |
|
40 | d = r.revision(n) | |
41 |
printb(b"node: %s" % |
|
41 | printb(b"node: %s" % hex(n)) | |
42 | printb(b"linkrev: %d" % r.linkrev(i)) |
|
42 | printb(b"linkrev: %d" % r.linkrev(i)) | |
43 |
printb(b"parents: %s %s" % ( |
|
43 | printb(b"parents: %s %s" % (hex(p[0]), hex(p[1]))) | |
44 | printb(b"length: %d" % len(d)) |
|
44 | printb(b"length: %d" % len(d)) | |
45 | printb(b"-start-") |
|
45 | printb(b"-start-") | |
46 | printb(d) |
|
46 | printb(d) |
@@ -6,9 +6,9 b'' | |||||
6 | from __future__ import absolute_import, print_function |
|
6 | from __future__ import absolute_import, print_function | |
7 |
|
7 | |||
8 | import sys |
|
8 | import sys | |
|
9 | from mercurial.node import bin | |||
9 | from mercurial import ( |
|
10 | from mercurial import ( | |
10 | encoding, |
|
11 | encoding, | |
11 | node, |
|
|||
12 | revlog, |
|
12 | revlog, | |
13 | transaction, |
|
13 | transaction, | |
14 | vfs as vfsmod, |
|
14 | vfs as vfsmod, | |
@@ -31,13 +31,13 b' while True:' | |||||
31 | r = revlog.revlog(opener, f) |
|
31 | r = revlog.revlog(opener, f) | |
32 | procutil.stdout.write(b'%s\n' % f) |
|
32 | procutil.stdout.write(b'%s\n' % f) | |
33 | elif l.startswith("node:"): |
|
33 | elif l.startswith("node:"): | |
34 |
n = |
|
34 | n = bin(l[6:-1]) | |
35 | elif l.startswith("linkrev:"): |
|
35 | elif l.startswith("linkrev:"): | |
36 | lr = int(l[9:-1]) |
|
36 | lr = int(l[9:-1]) | |
37 | elif l.startswith("parents:"): |
|
37 | elif l.startswith("parents:"): | |
38 | p = l[9:-1].split() |
|
38 | p = l[9:-1].split() | |
39 |
p1 = |
|
39 | p1 = bin(p[0]) | |
40 |
p2 = |
|
40 | p2 = bin(p[1]) | |
41 | elif l.startswith("length:"): |
|
41 | elif l.startswith("length:"): | |
42 | length = int(l[8:-1]) |
|
42 | length = int(l[8:-1]) | |
43 | sys.stdin.readline() # start marker |
|
43 | sys.stdin.readline() # start marker |
@@ -36,6 +36,11 b' from __future__ import absolute_import' | |||||
36 | import collections |
|
36 | import collections | |
37 |
|
37 | |||
38 | from mercurial.i18n import _ |
|
38 | from mercurial.i18n import _ | |
|
39 | from mercurial.node import ( | |||
|
40 | hex, | |||
|
41 | nullid, | |||
|
42 | short, | |||
|
43 | ) | |||
39 | from mercurial import ( |
|
44 | from mercurial import ( | |
40 | cmdutil, |
|
45 | cmdutil, | |
41 | commands, |
|
46 | commands, | |
@@ -44,7 +49,6 b' from mercurial import (' | |||||
44 | error, |
|
49 | error, | |
45 | linelog, |
|
50 | linelog, | |
46 | mdiff, |
|
51 | mdiff, | |
47 | node, |
|
|||
48 | obsolete, |
|
52 | obsolete, | |
49 | patch, |
|
53 | patch, | |
50 | phases, |
|
54 | phases, | |
@@ -102,7 +106,7 b' class emptyfilecontext(object):' | |||||
102 | return b'' |
|
106 | return b'' | |
103 |
|
107 | |||
104 | def node(self): |
|
108 | def node(self): | |
105 |
return |
|
109 | return nullid | |
106 |
|
110 | |||
107 |
|
111 | |||
108 | def uniq(lst): |
|
112 | def uniq(lst): | |
@@ -367,7 +371,7 b' class filefixupstate(object):' | |||||
367 | idx = (max(rev - 1, 0)) // 2 |
|
371 | idx = (max(rev - 1, 0)) // 2 | |
368 | self.ui.write( |
|
372 | self.ui.write( | |
369 | _(b'%s: chunk %d:%d -> %d lines\n') |
|
373 | _(b'%s: chunk %d:%d -> %d lines\n') | |
370 |
% ( |
|
374 | % (short(self.fctxs[idx].node()), a1, a2, len(blines)) | |
371 | ) |
|
375 | ) | |
372 | self.linelog.replacelines(rev, a1, a2, b1, b2) |
|
376 | self.linelog.replacelines(rev, a1, a2, b1, b2) | |
373 | if self.opts.get(b'edit_lines', False): |
|
377 | if self.opts.get(b'edit_lines', False): | |
@@ -486,7 +490,7 b' class filefixupstate(object):' | |||||
486 | editortext += _(b'HG: %s/%s %s %s\n') % ( |
|
490 | editortext += _(b'HG: %s/%s %s %s\n') % ( | |
487 | b'|' * i, |
|
491 | b'|' * i, | |
488 | b'-' * (len(visiblefctxs) - i + 1), |
|
492 | b'-' * (len(visiblefctxs) - i + 1), | |
489 |
|
|
493 | short(f.node()), | |
490 | f.description().split(b'\n', 1)[0], |
|
494 | f.description().split(b'\n', 1)[0], | |
491 | ) |
|
495 | ) | |
492 | editortext += _(b'HG: %s\n') % (b'|' * len(visiblefctxs)) |
|
496 | editortext += _(b'HG: %s\n') % (b'|' * len(visiblefctxs)) | |
@@ -816,7 +820,7 b' class fixupstate(object):' | |||||
816 | if self.ui.debugflag: |
|
820 | if self.ui.debugflag: | |
817 | return b'%d:%s' % (ctx.rev(), ctx.hex()) |
|
821 | return b'%d:%s' % (ctx.rev(), ctx.hex()) | |
818 | else: |
|
822 | else: | |
819 |
return b'%d:%s' % (ctx.rev(), |
|
823 | return b'%d:%s' % (ctx.rev(), short(ctx.node())) | |
820 |
|
824 | |||
821 | def _getnewfilecontents(self, ctx): |
|
825 | def _getnewfilecontents(self, ctx): | |
822 | """(ctx) -> {path: str} |
|
826 | """(ctx) -> {path: str} | |
@@ -849,7 +853,7 b' class fixupstate(object):' | |||||
849 | changes.append((name, hsh)) |
|
853 | changes.append((name, hsh)) | |
850 | if self.ui.verbose: |
|
854 | if self.ui.verbose: | |
851 | self.ui.write( |
|
855 | self.ui.write( | |
852 |
_(b'moving bookmark %s to %s\n') % (name, |
|
856 | _(b'moving bookmark %s to %s\n') % (name, hex(hsh)) | |
853 | ) |
|
857 | ) | |
854 | else: |
|
858 | else: | |
855 | changes.append((name, None)) |
|
859 | changes.append((name, None)) | |
@@ -920,7 +924,7 b' class fixupstate(object):' | |||||
920 | the commit is a clone from ctx, with a (optionally) different p1, and |
|
924 | the commit is a clone from ctx, with a (optionally) different p1, and | |
921 | different file contents replaced by memworkingcopy. |
|
925 | different file contents replaced by memworkingcopy. | |
922 | """ |
|
926 | """ | |
923 |
parents = p1 and (p1, |
|
927 | parents = p1 and (p1, nullid) | |
924 | extra = ctx.extra() |
|
928 | extra = ctx.extra() | |
925 | if self._useobsolete and self.ui.configbool(b'absorb', b'add-noise'): |
|
929 | if self._useobsolete and self.ui.configbool(b'absorb', b'add-noise'): | |
926 | extra[b'absorb_source'] = ctx.hex() |
|
930 | extra[b'absorb_source'] = ctx.hex() |
@@ -9,10 +9,10 b' from __future__ import absolute_import' | |||||
9 | import os |
|
9 | import os | |
10 |
|
10 | |||
11 | from mercurial.i18n import _ |
|
11 | from mercurial.i18n import _ | |
|
12 | from mercurial.node import nullhex | |||
12 | from mercurial import ( |
|
13 | from mercurial import ( | |
13 | config, |
|
14 | config, | |
14 | error, |
|
15 | error, | |
15 | node as nodemod, |
|
|||
16 | pycompat, |
|
16 | pycompat, | |
17 | ) |
|
17 | ) | |
18 |
|
18 | |||
@@ -192,7 +192,7 b' class convert_git(common.converter_sourc' | |||||
192 | return heads |
|
192 | return heads | |
193 |
|
193 | |||
194 | def catfile(self, rev, ftype): |
|
194 | def catfile(self, rev, ftype): | |
195 |
if rev == |
|
195 | if rev == nullhex: | |
196 | raise IOError |
|
196 | raise IOError | |
197 | self.catfilepipe[0].write(rev + b'\n') |
|
197 | self.catfilepipe[0].write(rev + b'\n') | |
198 | self.catfilepipe[0].flush() |
|
198 | self.catfilepipe[0].flush() | |
@@ -214,7 +214,7 b' class convert_git(common.converter_sourc' | |||||
214 | return data |
|
214 | return data | |
215 |
|
215 | |||
216 | def getfile(self, name, rev): |
|
216 | def getfile(self, name, rev): | |
217 |
if rev == |
|
217 | if rev == nullhex: | |
218 | return None, None |
|
218 | return None, None | |
219 | if name == b'.hgsub': |
|
219 | if name == b'.hgsub': | |
220 | data = b'\n'.join([m.hgsub() for m in self.submoditer()]) |
|
220 | data = b'\n'.join([m.hgsub() for m in self.submoditer()]) | |
@@ -228,7 +228,7 b' class convert_git(common.converter_sourc' | |||||
228 | return data, mode |
|
228 | return data, mode | |
229 |
|
229 | |||
230 | def submoditer(self): |
|
230 | def submoditer(self): | |
231 |
null = |
|
231 | null = nullhex | |
232 | for m in sorted(self.submodules, key=lambda p: p.path): |
|
232 | for m in sorted(self.submodules, key=lambda p: p.path): | |
233 | if m.node != null: |
|
233 | if m.node != null: | |
234 | yield m |
|
234 | yield m | |
@@ -316,7 +316,7 b' class convert_git(common.converter_sourc' | |||||
316 | subexists[0] = True |
|
316 | subexists[0] = True | |
317 | if entry[4] == b'D' or renamesource: |
|
317 | if entry[4] == b'D' or renamesource: | |
318 | subdeleted[0] = True |
|
318 | subdeleted[0] = True | |
319 |
changes.append((b'.hgsub', |
|
319 | changes.append((b'.hgsub', nullhex)) | |
320 | else: |
|
320 | else: | |
321 | changes.append((b'.hgsub', b'')) |
|
321 | changes.append((b'.hgsub', b'')) | |
322 | elif entry[1] == b'160000' or entry[0] == b':160000': |
|
322 | elif entry[1] == b'160000' or entry[0] == b':160000': | |
@@ -324,7 +324,7 b' class convert_git(common.converter_sourc' | |||||
324 | subexists[0] = True |
|
324 | subexists[0] = True | |
325 | else: |
|
325 | else: | |
326 | if renamesource: |
|
326 | if renamesource: | |
327 |
h = |
|
327 | h = nullhex | |
328 | self.modecache[(f, h)] = (p and b"x") or (s and b"l") or b"" |
|
328 | self.modecache[(f, h)] = (p and b"x") or (s and b"l") or b"" | |
329 | changes.append((f, h)) |
|
329 | changes.append((f, h)) | |
330 |
|
330 | |||
@@ -361,7 +361,7 b' class convert_git(common.converter_sourc' | |||||
361 |
|
361 | |||
362 | if subexists[0]: |
|
362 | if subexists[0]: | |
363 | if subdeleted[0]: |
|
363 | if subdeleted[0]: | |
364 |
changes.append((b'.hgsubstate', |
|
364 | changes.append((b'.hgsubstate', nullhex)) | |
365 | else: |
|
365 | else: | |
366 | self.retrievegitmodules(version) |
|
366 | self.retrievegitmodules(version) | |
367 | changes.append((b'.hgsubstate', b'')) |
|
367 | changes.append((b'.hgsubstate', b'')) |
@@ -24,6 +24,12 b' import time' | |||||
24 |
|
24 | |||
25 | from mercurial.i18n import _ |
|
25 | from mercurial.i18n import _ | |
26 | from mercurial.pycompat import open |
|
26 | from mercurial.pycompat import open | |
|
27 | from mercurial.node import ( | |||
|
28 | bin, | |||
|
29 | hex, | |||
|
30 | nullhex, | |||
|
31 | nullid, | |||
|
32 | ) | |||
27 | from mercurial import ( |
|
33 | from mercurial import ( | |
28 | bookmarks, |
|
34 | bookmarks, | |
29 | context, |
|
35 | context, | |
@@ -32,7 +38,6 b' from mercurial import (' | |||||
32 | hg, |
|
38 | hg, | |
33 | lock as lockmod, |
|
39 | lock as lockmod, | |
34 | merge as mergemod, |
|
40 | merge as mergemod, | |
35 | node as nodemod, |
|
|||
36 | phases, |
|
41 | phases, | |
37 | pycompat, |
|
42 | pycompat, | |
38 | scmutil, |
|
43 | scmutil, | |
@@ -155,7 +160,7 b' class mercurial_sink(common.converter_si' | |||||
155 | continue |
|
160 | continue | |
156 | revid = revmap.get(source.lookuprev(s[0])) |
|
161 | revid = revmap.get(source.lookuprev(s[0])) | |
157 | if not revid: |
|
162 | if not revid: | |
158 |
if s[0] == |
|
163 | if s[0] == nullhex: | |
159 | revid = s[0] |
|
164 | revid = s[0] | |
160 | else: |
|
165 | else: | |
161 | # missing, but keep for hash stability |
|
166 | # missing, but keep for hash stability | |
@@ -174,7 +179,7 b' class mercurial_sink(common.converter_si' | |||||
174 |
|
179 | |||
175 | revid = s[0] |
|
180 | revid = s[0] | |
176 | subpath = s[1] |
|
181 | subpath = s[1] | |
177 |
if revid != |
|
182 | if revid != nullhex: | |
178 | revmap = self.subrevmaps.get(subpath) |
|
183 | revmap = self.subrevmaps.get(subpath) | |
179 | if revmap is None: |
|
184 | if revmap is None: | |
180 | revmap = mapfile( |
|
185 | revmap = mapfile( | |
@@ -295,13 +300,13 b' class mercurial_sink(common.converter_si' | |||||
295 | parents = pl |
|
300 | parents = pl | |
296 | nparents = len(parents) |
|
301 | nparents = len(parents) | |
297 | if self.filemapmode and nparents == 1: |
|
302 | if self.filemapmode and nparents == 1: | |
298 |
m1node = self.repo.changelog.read( |
|
303 | m1node = self.repo.changelog.read(bin(parents[0]))[0] | |
299 | parent = parents[0] |
|
304 | parent = parents[0] | |
300 |
|
305 | |||
301 | if len(parents) < 2: |
|
306 | if len(parents) < 2: | |
302 |
parents.append( |
|
307 | parents.append(nullid) | |
303 | if len(parents) < 2: |
|
308 | if len(parents) < 2: | |
304 |
parents.append( |
|
309 | parents.append(nullid) | |
305 | p2 = parents.pop(0) |
|
310 | p2 = parents.pop(0) | |
306 |
|
311 | |||
307 | text = commit.desc |
|
312 | text = commit.desc | |
@@ -332,12 +337,12 b' class mercurial_sink(common.converter_si' | |||||
332 |
|
337 | |||
333 | # Only transplant stores its reference in binary |
|
338 | # Only transplant stores its reference in binary | |
334 | if label == b'transplant_source': |
|
339 | if label == b'transplant_source': | |
335 |
node = |
|
340 | node = hex(node) | |
336 |
|
341 | |||
337 | newrev = revmap.get(node) |
|
342 | newrev = revmap.get(node) | |
338 | if newrev is not None: |
|
343 | if newrev is not None: | |
339 | if label == b'transplant_source': |
|
344 | if label == b'transplant_source': | |
340 |
newrev = |
|
345 | newrev = bin(newrev) | |
341 |
|
346 | |||
342 | extra[label] = newrev |
|
347 | extra[label] = newrev | |
343 |
|
348 | |||
@@ -351,7 +356,7 b' class mercurial_sink(common.converter_si' | |||||
351 | p2 = parents.pop(0) |
|
356 | p2 = parents.pop(0) | |
352 | p1ctx = self.repo[p1] |
|
357 | p1ctx = self.repo[p1] | |
353 | p2ctx = None |
|
358 | p2ctx = None | |
354 |
if p2 != |
|
359 | if p2 != nullid: | |
355 | p2ctx = self.repo[p2] |
|
360 | p2ctx = self.repo[p2] | |
356 | fileset = set(files) |
|
361 | fileset = set(files) | |
357 | if full: |
|
362 | if full: | |
@@ -389,7 +394,7 b' class mercurial_sink(common.converter_si' | |||||
389 | origctx = commit.ctx |
|
394 | origctx = commit.ctx | |
390 | else: |
|
395 | else: | |
391 | origctx = None |
|
396 | origctx = None | |
392 |
node = |
|
397 | node = hex(self.repo.commitctx(ctx, origctx=origctx)) | |
393 |
|
398 | |||
394 | # If the node value has changed, but the phase is lower than |
|
399 | # If the node value has changed, but the phase is lower than | |
395 | # draft, set it back to draft since it hasn't been exposed |
|
400 | # draft, set it back to draft since it hasn't been exposed | |
@@ -406,7 +411,7 b' class mercurial_sink(common.converter_si' | |||||
406 |
|
411 | |||
407 | if self.filemapmode and nparents == 1: |
|
412 | if self.filemapmode and nparents == 1: | |
408 | man = self.repo.manifestlog.getstorage(b'') |
|
413 | man = self.repo.manifestlog.getstorage(b'') | |
409 |
mnode = self.repo.changelog.read( |
|
414 | mnode = self.repo.changelog.read(bin(p2))[0] | |
410 | closed = b'close' in commit.extra |
|
415 | closed = b'close' in commit.extra | |
411 | if not closed and not man.cmp(m1node, man.revision(mnode)): |
|
416 | if not closed and not man.cmp(m1node, man.revision(mnode)): | |
412 | self.ui.status(_(b"filtering out empty revision\n")) |
|
417 | self.ui.status(_(b"filtering out empty revision\n")) | |
@@ -416,7 +421,7 b' class mercurial_sink(common.converter_si' | |||||
416 |
|
421 | |||
417 | def puttags(self, tags): |
|
422 | def puttags(self, tags): | |
418 | tagparent = self.repo.branchtip(self.tagsbranch, ignoremissing=True) |
|
423 | tagparent = self.repo.branchtip(self.tagsbranch, ignoremissing=True) | |
419 |
tagparent = tagparent or |
|
424 | tagparent = tagparent or nullid | |
420 |
|
425 | |||
421 | oldlines = set() |
|
426 | oldlines = set() | |
422 | for branch, heads in pycompat.iteritems(self.repo.branchmap()): |
|
427 | for branch, heads in pycompat.iteritems(self.repo.branchmap()): | |
@@ -468,7 +473,7 b' class mercurial_sink(common.converter_si' | |||||
468 | extra, |
|
473 | extra, | |
469 | ) |
|
474 | ) | |
470 | node = self.repo.commitctx(ctx) |
|
475 | node = self.repo.commitctx(ctx) | |
471 |
return |
|
476 | return hex(node), hex(tagparent) | |
472 |
|
477 | |||
473 | def setfilemapmode(self, active): |
|
478 | def setfilemapmode(self, active): | |
474 | self.filemapmode = active |
|
479 | self.filemapmode = active | |
@@ -484,7 +489,7 b' class mercurial_sink(common.converter_si' | |||||
484 | self.ui.status(_(b"updating bookmarks\n")) |
|
489 | self.ui.status(_(b"updating bookmarks\n")) | |
485 | destmarks = self.repo._bookmarks |
|
490 | destmarks = self.repo._bookmarks | |
486 | changes = [ |
|
491 | changes = [ | |
487 |
(bookmark, |
|
492 | (bookmark, bin(updatedbookmark[bookmark])) | |
488 | for bookmark in updatedbookmark |
|
493 | for bookmark in updatedbookmark | |
489 | ] |
|
494 | ] | |
490 | destmarks.applychanges(self.repo, tr, changes) |
|
495 | destmarks.applychanges(self.repo, tr, changes) | |
@@ -577,7 +582,7 b' class mercurial_source(common.converter_' | |||||
577 | return [p for p in ctx.parents() if p and self.keep(p.node())] |
|
582 | return [p for p in ctx.parents() if p and self.keep(p.node())] | |
578 |
|
583 | |||
579 | def getheads(self): |
|
584 | def getheads(self): | |
580 |
return [ |
|
585 | return [hex(h) for h in self._heads if self.keep(h)] | |
581 |
|
586 | |||
582 | def getfile(self, name, rev): |
|
587 | def getfile(self, name, rev): | |
583 | try: |
|
588 | try: | |
@@ -678,9 +683,7 b' class mercurial_source(common.converter_' | |||||
678 | for t in self.repo.tagslist() |
|
683 | for t in self.repo.tagslist() | |
679 | if self.repo.tagtype(t[0]) == b'global' |
|
684 | if self.repo.tagtype(t[0]) == b'global' | |
680 | ] |
|
685 | ] | |
681 | return { |
|
686 | return {name: hex(node) for name, node in tags if self.keep(node)} | |
682 | name: nodemod.hex(node) for name, node in tags if self.keep(node) |
|
|||
683 | } |
|
|||
684 |
|
687 | |||
685 | def getchangedfiles(self, rev, i): |
|
688 | def getchangedfiles(self, rev, i): | |
686 | ctx = self._changectx(rev) |
|
689 | ctx = self._changectx(rev) | |
@@ -718,7 +721,7 b' class mercurial_source(common.converter_' | |||||
718 |
|
721 | |||
719 | def lookuprev(self, rev): |
|
722 | def lookuprev(self, rev): | |
720 | try: |
|
723 | try: | |
721 |
return |
|
724 | return hex(self.repo.lookup(rev)) | |
722 | except (error.RepoError, error.LookupError): |
|
725 | except (error.RepoError, error.LookupError): | |
723 | return None |
|
726 | return None | |
724 |
|
727 |
@@ -17,12 +17,16 b' from mercurial.pycompat import (' | |||||
17 | open, |
|
17 | open, | |
18 | setattr, |
|
18 | setattr, | |
19 | ) |
|
19 | ) | |
|
20 | from mercurial.node import ( | |||
|
21 | bin, | |||
|
22 | hex, | |||
|
23 | short, | |||
|
24 | ) | |||
20 | from mercurial import ( |
|
25 | from mercurial import ( | |
21 | error, |
|
26 | error, | |
22 | linelog as linelogmod, |
|
27 | linelog as linelogmod, | |
23 | lock as lockmod, |
|
28 | lock as lockmod, | |
24 | mdiff, |
|
29 | mdiff, | |
25 | node, |
|
|||
26 | pycompat, |
|
30 | pycompat, | |
27 | scmutil, |
|
31 | scmutil, | |
28 | util, |
|
32 | util, | |
@@ -150,7 +154,7 b' def hashdiffopts(diffopts):' | |||||
150 | diffoptstr = stringutil.pprint( |
|
154 | diffoptstr = stringutil.pprint( | |
151 | sorted((k, getattr(diffopts, k)) for k in mdiff.diffopts.defaults) |
|
155 | sorted((k, getattr(diffopts, k)) for k in mdiff.diffopts.defaults) | |
152 | ) |
|
156 | ) | |
153 |
return |
|
157 | return hex(hashutil.sha1(diffoptstr).digest())[:6] | |
154 |
|
158 | |||
155 |
|
159 | |||
156 | _defaultdiffopthash = hashdiffopts(mdiff.defaultopts) |
|
160 | _defaultdiffopthash = hashdiffopts(mdiff.defaultopts) | |
@@ -308,7 +312,7 b' class _annotatecontext(object):' | |||||
308 | # command could give us a revision number even if the user passes a |
|
312 | # command could give us a revision number even if the user passes a | |
309 | # commit hash. |
|
313 | # commit hash. | |
310 | if isinstance(rev, int): |
|
314 | if isinstance(rev, int): | |
311 |
rev = |
|
315 | rev = hex(self.repo.changelog.node(rev)) | |
312 |
|
316 | |||
313 | # fast path: if rev is in the main branch already |
|
317 | # fast path: if rev is in the main branch already | |
314 | directly, revfctx = self.canannotatedirectly(rev) |
|
318 | directly, revfctx = self.canannotatedirectly(rev) | |
@@ -493,7 +497,7 b' class _annotatecontext(object):' | |||||
493 | result = True |
|
497 | result = True | |
494 | f = None |
|
498 | f = None | |
495 | if not isinstance(rev, int) and rev is not None: |
|
499 | if not isinstance(rev, int) and rev is not None: | |
496 |
hsh = {20: bytes, 40: |
|
500 | hsh = {20: bytes, 40: bin}.get(len(rev), lambda x: None)(rev) | |
497 | if hsh is not None and (hsh, self.path) in self.revmap: |
|
501 | if hsh is not None and (hsh, self.path) in self.revmap: | |
498 | f = hsh |
|
502 | f = hsh | |
499 | if f is None: |
|
503 | if f is None: | |
@@ -598,7 +602,7 b' class _annotatecontext(object):' | |||||
598 | self.ui.debug( |
|
602 | self.ui.debug( | |
599 | b'fastannotate: reading %s line #%d ' |
|
603 | b'fastannotate: reading %s line #%d ' | |
600 | b'to resolve lines %r\n' |
|
604 | b'to resolve lines %r\n' | |
601 |
% ( |
|
605 | % (short(hsh), linenum, idxs) | |
602 | ) |
|
606 | ) | |
603 | fctx = self._resolvefctx(hsh, revmap.rev2path(rev)) |
|
607 | fctx = self._resolvefctx(hsh, revmap.rev2path(rev)) | |
604 | lines = mdiff.splitnewlines(fctx.data()) |
|
608 | lines = mdiff.splitnewlines(fctx.data()) | |
@@ -610,8 +614,7 b' class _annotatecontext(object):' | |||||
610 |
|
614 | |||
611 | # run the annotate and the lines should match to the file content |
|
615 | # run the annotate and the lines should match to the file content | |
612 | self.ui.debug( |
|
616 | self.ui.debug( | |
613 | b'fastannotate: annotate %s to resolve lines\n' |
|
617 | b'fastannotate: annotate %s to resolve lines\n' % short(hsh) | |
614 | % node.short(hsh) |
|
|||
615 | ) |
|
618 | ) | |
616 | linelog.annotate(rev) |
|
619 | linelog.annotate(rev) | |
617 | fctx = self._resolvefctx(hsh, revmap.rev2path(rev)) |
|
620 | fctx = self._resolvefctx(hsh, revmap.rev2path(rev)) | |
@@ -640,12 +643,10 b' class _annotatecontext(object):' | |||||
640 | hsh = f.node() |
|
643 | hsh = f.node() | |
641 | llrev = self.revmap.hsh2rev(hsh) |
|
644 | llrev = self.revmap.hsh2rev(hsh) | |
642 | if not llrev: |
|
645 | if not llrev: | |
643 | raise faerror.CorruptedFileError( |
|
646 | raise faerror.CorruptedFileError(b'%s is not in revmap' % hex(hsh)) | |
644 | b'%s is not in revmap' % node.hex(hsh) |
|
|||
645 | ) |
|
|||
646 | if (self.revmap.rev2flag(llrev) & revmapmod.sidebranchflag) != 0: |
|
647 | if (self.revmap.rev2flag(llrev) & revmapmod.sidebranchflag) != 0: | |
647 | raise faerror.CorruptedFileError( |
|
648 | raise faerror.CorruptedFileError( | |
648 |
b'%s is not in revmap mainbranch' % |
|
649 | b'%s is not in revmap mainbranch' % hex(hsh) | |
649 | ) |
|
650 | ) | |
650 | self.linelog.annotate(llrev) |
|
651 | self.linelog.annotate(llrev) | |
651 | result = [ |
|
652 | result = [ |
@@ -6,9 +6,12 b'' | |||||
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 | from __future__ import absolute_import |
|
7 | from __future__ import absolute_import | |
8 |
|
8 | |||
|
9 | from mercurial.node import ( | |||
|
10 | hex, | |||
|
11 | short, | |||
|
12 | ) | |||
9 | from mercurial import ( |
|
13 | from mercurial import ( | |
10 | encoding, |
|
14 | encoding, | |
11 | node, |
|
|||
12 | pycompat, |
|
15 | pycompat, | |
13 | templatefilters, |
|
16 | templatefilters, | |
14 | util, |
|
17 | util, | |
@@ -116,9 +119,9 b' class defaultformatter(object):' | |||||
116 | @util.propertycache |
|
119 | @util.propertycache | |
117 | def _hexfunc(self): |
|
120 | def _hexfunc(self): | |
118 | if self.ui.debugflag or self.opts.get(b'long_hash'): |
|
121 | if self.ui.debugflag or self.opts.get(b'long_hash'): | |
119 |
return |
|
122 | return hex | |
120 | else: |
|
123 | else: | |
121 |
return |
|
124 | return short | |
122 |
|
125 | |||
123 | def end(self): |
|
126 | def end(self): | |
124 | pass |
|
127 | pass | |
@@ -168,7 +171,7 b' class jsonformatter(defaultformatter):' | |||||
168 |
|
171 | |||
169 | @util.propertycache |
|
172 | @util.propertycache | |
170 | def _hexfunc(self): |
|
173 | def _hexfunc(self): | |
171 |
return |
|
174 | return hex | |
172 |
|
175 | |||
173 | def end(self): |
|
176 | def end(self): | |
174 | self.ui.write(b'\n]\n') |
|
177 | self.ui.write(b'\n]\n') |
@@ -4,11 +4,11 b' import contextlib' | |||||
4 | import errno |
|
4 | import errno | |
5 | import os |
|
5 | import os | |
6 |
|
6 | |||
|
7 | from mercurial.node import nullid | |||
7 | from mercurial import ( |
|
8 | from mercurial import ( | |
8 | error, |
|
9 | error, | |
9 | extensions, |
|
10 | extensions, | |
10 | match as matchmod, |
|
11 | match as matchmod, | |
11 | node as nodemod, |
|
|||
12 | pycompat, |
|
12 | pycompat, | |
13 | scmutil, |
|
13 | scmutil, | |
14 | util, |
|
14 | util, | |
@@ -81,14 +81,14 b' class gitdirstate(object):' | |||||
81 | except pygit2.GitError: |
|
81 | except pygit2.GitError: | |
82 | # Typically happens when peeling HEAD fails, as in an |
|
82 | # Typically happens when peeling HEAD fails, as in an | |
83 | # empty repository. |
|
83 | # empty repository. | |
84 |
return |
|
84 | return nullid | |
85 |
|
85 | |||
86 | def p2(self): |
|
86 | def p2(self): | |
87 | # TODO: MERGE_HEAD? something like that, right? |
|
87 | # TODO: MERGE_HEAD? something like that, right? | |
88 |
return |
|
88 | return nullid | |
89 |
|
89 | |||
90 |
def setparents(self, p1, p2= |
|
90 | def setparents(self, p1, p2=nullid): | |
91 |
assert p2 == |
|
91 | assert p2 == nullid, b'TODO merging support' | |
92 | self.git.head.set_target(gitutil.togitnode(p1)) |
|
92 | self.git.head.set_target(gitutil.togitnode(p1)) | |
93 |
|
93 | |||
94 | @util.propertycache |
|
94 | @util.propertycache | |
@@ -102,7 +102,7 b' class gitdirstate(object):' | |||||
102 |
|
102 | |||
103 | def parents(self): |
|
103 | def parents(self): | |
104 | # TODO how on earth do we find p2 if a merge is in flight? |
|
104 | # TODO how on earth do we find p2 if a merge is in flight? | |
105 |
return self.p1(), |
|
105 | return self.p1(), nullid | |
106 |
|
106 | |||
107 | def __iter__(self): |
|
107 | def __iter__(self): | |
108 | return (pycompat.fsencode(f.path) for f in self.git.index) |
|
108 | return (pycompat.fsencode(f.path) for f in self.git.index) |
@@ -2,6 +2,14 b' from __future__ import absolute_import' | |||||
2 |
|
2 | |||
3 | from mercurial.i18n import _ |
|
3 | from mercurial.i18n import _ | |
4 |
|
4 | |||
|
5 | from mercurial.node import ( | |||
|
6 | bin, | |||
|
7 | hex, | |||
|
8 | nullhex, | |||
|
9 | nullid, | |||
|
10 | nullrev, | |||
|
11 | wdirhex, | |||
|
12 | ) | |||
5 | from mercurial import ( |
|
13 | from mercurial import ( | |
6 | ancestor, |
|
14 | ancestor, | |
7 | changelog as hgchangelog, |
|
15 | changelog as hgchangelog, | |
@@ -9,7 +17,6 b' from mercurial import (' | |||||
9 | encoding, |
|
17 | encoding, | |
10 | error, |
|
18 | error, | |
11 | manifest, |
|
19 | manifest, | |
12 | node as nodemod, |
|
|||
13 | pycompat, |
|
20 | pycompat, | |
14 | ) |
|
21 | ) | |
15 | from mercurial.interfaces import ( |
|
22 | from mercurial.interfaces import ( | |
@@ -39,7 +46,7 b' class baselog(object): # revlog.revlog)' | |||||
39 | ) |
|
46 | ) | |
40 |
|
47 | |||
41 | def rev(self, n): |
|
48 | def rev(self, n): | |
42 |
if n == |
|
49 | if n == nullid: | |
43 | return -1 |
|
50 | return -1 | |
44 | t = self._db.execute( |
|
51 | t = self._db.execute( | |
45 | 'SELECT rev FROM changelog WHERE node = ?', (gitutil.togitnode(n),) |
|
52 | 'SELECT rev FROM changelog WHERE node = ?', (gitutil.togitnode(n),) | |
@@ -49,14 +56,14 b' class baselog(object): # revlog.revlog)' | |||||
49 | return t[0] |
|
56 | return t[0] | |
50 |
|
57 | |||
51 | def node(self, r): |
|
58 | def node(self, r): | |
52 |
if r == |
|
59 | if r == nullrev: | |
53 |
return |
|
60 | return nullid | |
54 | t = self._db.execute( |
|
61 | t = self._db.execute( | |
55 | 'SELECT node FROM changelog WHERE rev = ?', (r,) |
|
62 | 'SELECT node FROM changelog WHERE rev = ?', (r,) | |
56 | ).fetchone() |
|
63 | ).fetchone() | |
57 | if t is None: |
|
64 | if t is None: | |
58 | raise error.LookupError(r, b'00changelog.i', _(b'no node')) |
|
65 | raise error.LookupError(r, b'00changelog.i', _(b'no node')) | |
59 |
return |
|
66 | return bin(t[0]) | |
60 |
|
67 | |||
61 | def hasnode(self, n): |
|
68 | def hasnode(self, n): | |
62 | t = self._db.execute( |
|
69 | t = self._db.execute( | |
@@ -123,10 +130,10 b' class changelog(baselog):' | |||||
123 | @property |
|
130 | @property | |
124 | def nodemap(self): |
|
131 | def nodemap(self): | |
125 | r = { |
|
132 | r = { | |
126 |
|
|
133 | bin(v[0]): v[1] | |
127 | for v in self._db.execute('SELECT node, rev FROM changelog') |
|
134 | for v in self._db.execute('SELECT node, rev FROM changelog') | |
128 | } |
|
135 | } | |
129 |
r[ |
|
136 | r[nullid] = nullrev | |
130 | return r |
|
137 | return r | |
131 |
|
138 | |||
132 | def tip(self): |
|
139 | def tip(self): | |
@@ -134,8 +141,8 b' class changelog(baselog):' | |||||
134 | 'SELECT node FROM changelog ORDER BY rev DESC LIMIT 1' |
|
141 | 'SELECT node FROM changelog ORDER BY rev DESC LIMIT 1' | |
135 | ).fetchone() |
|
142 | ).fetchone() | |
136 | if t: |
|
143 | if t: | |
137 |
return |
|
144 | return bin(t[0]) | |
138 |
return |
|
145 | return nullid | |
139 |
|
146 | |||
140 | def revs(self, start=0, stop=None): |
|
147 | def revs(self, start=0, stop=None): | |
141 | if stop is None: |
|
148 | if stop is None: | |
@@ -155,16 +162,16 b' class changelog(baselog):' | |||||
155 | return next(t) |
|
162 | return next(t) | |
156 |
|
163 | |||
157 | def _partialmatch(self, id): |
|
164 | def _partialmatch(self, id): | |
158 |
if |
|
165 | if wdirhex.startswith(id): | |
159 | raise error.WdirUnsupported |
|
166 | raise error.WdirUnsupported | |
160 | candidates = [ |
|
167 | candidates = [ | |
161 |
|
|
168 | bin(x[0]) | |
162 | for x in self._db.execute( |
|
169 | for x in self._db.execute( | |
163 | 'SELECT node FROM changelog WHERE node LIKE ?', (id + b'%',) |
|
170 | 'SELECT node FROM changelog WHERE node LIKE ?', (id + b'%',) | |
164 | ) |
|
171 | ) | |
165 | ] |
|
172 | ] | |
166 |
if |
|
173 | if nullhex.startswith(id): | |
167 |
candidates.append( |
|
174 | candidates.append(nullid) | |
168 | if len(candidates) > 1: |
|
175 | if len(candidates) > 1: | |
169 | raise error.AmbiguousPrefixLookupError( |
|
176 | raise error.AmbiguousPrefixLookupError( | |
170 | id, b'00changelog.i', _(b'ambiguous identifier') |
|
177 | id, b'00changelog.i', _(b'ambiguous identifier') | |
@@ -177,7 +184,7 b' class changelog(baselog):' | |||||
177 | return 0 |
|
184 | return 0 | |
178 |
|
185 | |||
179 | def shortest(self, node, minlength=1): |
|
186 | def shortest(self, node, minlength=1): | |
180 |
nodehex = |
|
187 | nodehex = hex(node) | |
181 | for attempt in pycompat.xrange(minlength, len(nodehex) + 1): |
|
188 | for attempt in pycompat.xrange(minlength, len(nodehex) + 1): | |
182 | candidate = nodehex[:attempt] |
|
189 | candidate = nodehex[:attempt] | |
183 | matches = int( |
|
190 | matches = int( | |
@@ -209,7 +216,7 b' class changelog(baselog):' | |||||
209 | else: |
|
216 | else: | |
210 | n = nodeorrev |
|
217 | n = nodeorrev | |
211 | # handle looking up nullid |
|
218 | # handle looking up nullid | |
212 |
if n == |
|
219 | if n == nullid: | |
213 | return hgchangelog._changelogrevision(extra={}) |
|
220 | return hgchangelog._changelogrevision(extra={}) | |
214 | hn = gitutil.togitnode(n) |
|
221 | hn = gitutil.togitnode(n) | |
215 | # We've got a real commit! |
|
222 | # We've got a real commit! | |
@@ -226,7 +233,7 b' class changelog(baselog):' | |||||
226 | for r in self._db.execute( |
|
233 | for r in self._db.execute( | |
227 | 'SELECT filename FROM changedfiles ' |
|
234 | 'SELECT filename FROM changedfiles ' | |
228 | 'WHERE node = ? and filenode = ?', |
|
235 | 'WHERE node = ? and filenode = ?', | |
229 |
(hn, |
|
236 | (hn, nullhex), | |
230 | ) |
|
237 | ) | |
231 | ] |
|
238 | ] | |
232 | c = self.gitrepo[hn] |
|
239 | c = self.gitrepo[hn] | |
@@ -267,7 +274,7 b' class changelog(baselog):' | |||||
267 | nullrev. |
|
274 | nullrev. | |
268 | """ |
|
275 | """ | |
269 | if common is None: |
|
276 | if common is None: | |
270 |
common = [ |
|
277 | common = [nullrev] | |
271 |
|
278 | |||
272 | return ancestor.incrementalmissingancestors(self.parentrevs, common) |
|
279 | return ancestor.incrementalmissingancestors(self.parentrevs, common) | |
273 |
|
280 | |||
@@ -287,7 +294,7 b' class changelog(baselog):' | |||||
287 | not supplied, uses all of the revlog's heads. If common is not |
|
294 | not supplied, uses all of the revlog's heads. If common is not | |
288 | supplied, uses nullid.""" |
|
295 | supplied, uses nullid.""" | |
289 | if common is None: |
|
296 | if common is None: | |
290 |
common = [ |
|
297 | common = [nullid] | |
291 | if heads is None: |
|
298 | if heads is None: | |
292 | heads = self.heads() |
|
299 | heads = self.heads() | |
293 |
|
300 | |||
@@ -302,12 +309,12 b' class changelog(baselog):' | |||||
302 | c = [] |
|
309 | c = [] | |
303 | p = self.rev(node) |
|
310 | p = self.rev(node) | |
304 | for r in self.revs(start=p + 1): |
|
311 | for r in self.revs(start=p + 1): | |
305 |
prevs = [pr for pr in self.parentrevs(r) if pr != |
|
312 | prevs = [pr for pr in self.parentrevs(r) if pr != nullrev] | |
306 | if prevs: |
|
313 | if prevs: | |
307 | for pr in prevs: |
|
314 | for pr in prevs: | |
308 | if pr == p: |
|
315 | if pr == p: | |
309 | c.append(self.node(r)) |
|
316 | c.append(self.node(r)) | |
310 |
elif p == |
|
317 | elif p == nullrev: | |
311 | c.append(self.node(r)) |
|
318 | c.append(self.node(r)) | |
312 | return c |
|
319 | return c | |
313 |
|
320 | |||
@@ -323,7 +330,7 b' class changelog(baselog):' | |||||
323 |
|
330 | |||
324 | # Cleanup opportunity: this is *identical* to the revlog.py version |
|
331 | # Cleanup opportunity: this is *identical* to the revlog.py version | |
325 | def isancestorrev(self, a, b): |
|
332 | def isancestorrev(self, a, b): | |
326 |
if a == |
|
333 | if a == nullrev: | |
327 | return True |
|
334 | return True | |
328 | elif a == b: |
|
335 | elif a == b: | |
329 | return True |
|
336 | return True | |
@@ -337,8 +344,8 b' class changelog(baselog):' | |||||
337 | if hn != gitutil.nullgit: |
|
344 | if hn != gitutil.nullgit: | |
338 | c = self.gitrepo[hn] |
|
345 | c = self.gitrepo[hn] | |
339 | else: |
|
346 | else: | |
340 |
return |
|
347 | return nullrev, nullrev | |
341 |
p1 = p2 = |
|
348 | p1 = p2 = nullrev | |
342 | if c.parents: |
|
349 | if c.parents: | |
343 | p1 = self.rev(c.parents[0].id.raw) |
|
350 | p1 = self.rev(c.parents[0].id.raw) | |
344 | if len(c.parents) > 2: |
|
351 | if len(c.parents) > 2: | |
@@ -386,9 +393,9 b' class changelog(baselog):' | |||||
386 | ): |
|
393 | ): | |
387 | parents = [] |
|
394 | parents = [] | |
388 | hp1, hp2 = gitutil.togitnode(p1), gitutil.togitnode(p2) |
|
395 | hp1, hp2 = gitutil.togitnode(p1), gitutil.togitnode(p2) | |
389 |
if p1 != |
|
396 | if p1 != nullid: | |
390 | parents.append(hp1) |
|
397 | parents.append(hp1) | |
391 |
if p2 and p2 != |
|
398 | if p2 and p2 != nullid: | |
392 | parents.append(hp2) |
|
399 | parents.append(hp2) | |
393 | assert date is not None |
|
400 | assert date is not None | |
394 | timestamp, tz = date |
|
401 | timestamp, tz = date | |
@@ -419,7 +426,7 b' class manifestlog(baselog):' | |||||
419 | return self.get(b'', node) |
|
426 | return self.get(b'', node) | |
420 |
|
427 | |||
421 | def get(self, relpath, node): |
|
428 | def get(self, relpath, node): | |
422 |
if node == |
|
429 | if node == nullid: | |
423 | # TODO: this should almost certainly be a memgittreemanifestctx |
|
430 | # TODO: this should almost certainly be a memgittreemanifestctx | |
424 | return manifest.memtreemanifestctx(self, relpath) |
|
431 | return manifest.memtreemanifestctx(self, relpath) | |
425 | commit = self.gitrepo[gitutil.togitnode(node)] |
|
432 | commit = self.gitrepo[gitutil.togitnode(node)] | |
@@ -440,7 +447,7 b' class filelog(baselog):' | |||||
440 | self.path = path |
|
447 | self.path = path | |
441 |
|
448 | |||
442 | def read(self, node): |
|
449 | def read(self, node): | |
443 |
if node == |
|
450 | if node == nullid: | |
444 | return b'' |
|
451 | return b'' | |
445 | return self.gitrepo[gitutil.togitnode(node)].data |
|
452 | return self.gitrepo[gitutil.togitnode(node)].data | |
446 |
|
453 | |||
@@ -450,7 +457,7 b' class filelog(baselog):' | |||||
450 | if isinstance(node, int): |
|
457 | if isinstance(node, int): | |
451 | assert False, b'todo revnums for nodes' |
|
458 | assert False, b'todo revnums for nodes' | |
452 | if len(node) == 40: |
|
459 | if len(node) == 40: | |
453 |
node = |
|
460 | node = bin(node) | |
454 | hnode = gitutil.togitnode(node) |
|
461 | hnode = gitutil.togitnode(node) | |
455 | if hnode in self.gitrepo: |
|
462 | if hnode in self.gitrepo: | |
456 | return node |
|
463 | return node | |
@@ -500,7 +507,7 b' WHERE changelog.rev = ? AND filename = ?' | |||||
500 | ).fetchone() |
|
507 | ).fetchone() | |
501 | if maybe is None: |
|
508 | if maybe is None: | |
502 | raise IndexError('gitlog %r out of range %d' % (self.path, rev)) |
|
509 | raise IndexError('gitlog %r out of range %d' % (self.path, rev)) | |
503 |
return |
|
510 | return bin(maybe[0]) | |
504 |
|
511 | |||
505 | def parents(self, node): |
|
512 | def parents(self, node): | |
506 | gn = gitutil.togitnode(node) |
|
513 | gn = gitutil.togitnode(node) | |
@@ -525,7 +532,7 b' WHERE filenode = ? AND filename = ?' | |||||
525 | index.fill_in_filelog(self.gitrepo, self._db, commit, gp, gn) |
|
532 | index.fill_in_filelog(self.gitrepo, self._db, commit, gp, gn) | |
526 | return self.parents(node) |
|
533 | return self.parents(node) | |
527 | else: |
|
534 | else: | |
528 |
ps.append( |
|
535 | ps.append(bin(p)) | |
529 | return ps |
|
536 | return ps | |
530 |
|
537 | |||
531 | def renamed(self, node): |
|
538 | def renamed(self, node): |
@@ -5,11 +5,14 b' import os' | |||||
5 | import sqlite3 |
|
5 | import sqlite3 | |
6 |
|
6 | |||
7 | from mercurial.i18n import _ |
|
7 | from mercurial.i18n import _ | |
|
8 | from mercurial.node import ( | |||
|
9 | nullhex, | |||
|
10 | nullid, | |||
|
11 | ) | |||
8 |
|
12 | |||
9 | from mercurial import ( |
|
13 | from mercurial import ( | |
10 | encoding, |
|
14 | encoding, | |
11 | error, |
|
15 | error, | |
12 | node as nodemod, |
|
|||
13 | pycompat, |
|
16 | pycompat, | |
14 | ) |
|
17 | ) | |
15 |
|
18 | |||
@@ -278,7 +281,7 b' def _index_repo(' | |||||
278 | for pos, commit in enumerate(walker): |
|
281 | for pos, commit in enumerate(walker): | |
279 | if prog is not None: |
|
282 | if prog is not None: | |
280 | prog.update(pos) |
|
283 | prog.update(pos) | |
281 |
p1 = p2 = |
|
284 | p1 = p2 = nullhex | |
282 | if len(commit.parents) > 2: |
|
285 | if len(commit.parents) > 2: | |
283 | raise error.ProgrammingError( |
|
286 | raise error.ProgrammingError( | |
284 | ( |
|
287 | ( | |
@@ -315,9 +318,7 b' def _index_repo(' | |||||
315 | ) |
|
318 | ) | |
316 | new_files = (p.delta.new_file for p in patchgen) |
|
319 | new_files = (p.delta.new_file for p in patchgen) | |
317 | files = { |
|
320 | files = { | |
318 | nf.path: nf.id.hex |
|
321 | nf.path: nf.id.hex for nf in new_files if nf.id.raw != nullid | |
319 | for nf in new_files |
|
|||
320 | if nf.id.raw != nodemod.nullid |
|
|||
321 | } |
|
322 | } | |
322 | for p, n in files.items(): |
|
323 | for p, n in files.items(): | |
323 | # We intentionally set NULLs for any file parentage |
|
324 | # We intentionally set NULLs for any file parentage |
@@ -11,12 +11,17 b' import binascii' | |||||
11 | import os |
|
11 | import os | |
12 |
|
12 | |||
13 | from mercurial.i18n import _ |
|
13 | from mercurial.i18n import _ | |
|
14 | from mercurial.node import ( | |||
|
15 | bin, | |||
|
16 | hex, | |||
|
17 | nullid, | |||
|
18 | short, | |||
|
19 | ) | |||
14 | from mercurial import ( |
|
20 | from mercurial import ( | |
15 | cmdutil, |
|
21 | cmdutil, | |
16 | error, |
|
22 | error, | |
17 | help, |
|
23 | help, | |
18 | match, |
|
24 | match, | |
19 | node as hgnode, |
|
|||
20 | pycompat, |
|
25 | pycompat, | |
21 | registrar, |
|
26 | registrar, | |
22 | ) |
|
27 | ) | |
@@ -155,7 +160,7 b' def sigwalk(repo):' | |||||
155 | # read the heads |
|
160 | # read the heads | |
156 | fl = repo.file(b".hgsigs") |
|
161 | fl = repo.file(b".hgsigs") | |
157 | for r in reversed(fl.heads()): |
|
162 | for r in reversed(fl.heads()): | |
158 |
fn = b".hgsigs|%s" % |
|
163 | fn = b".hgsigs|%s" % short(r) | |
159 | for item in parsefile(fl.read(r).splitlines(), fn): |
|
164 | for item in parsefile(fl.read(r).splitlines(), fn): | |
160 | yield item |
|
165 | yield item | |
161 | try: |
|
166 | try: | |
@@ -172,7 +177,7 b' def getkeys(ui, repo, mygpg, sigdata, co' | |||||
172 | fn, ln = context |
|
177 | fn, ln = context | |
173 | node, version, sig = sigdata |
|
178 | node, version, sig = sigdata | |
174 | prefix = b"%s:%d" % (fn, ln) |
|
179 | prefix = b"%s:%d" % (fn, ln) | |
175 |
node = |
|
180 | node = bin(node) | |
176 |
|
181 | |||
177 | data = node2txt(repo, node, version) |
|
182 | data = node2txt(repo, node, version) | |
178 | sig = binascii.a2b_base64(sig) |
|
183 | sig = binascii.a2b_base64(sig) | |
@@ -223,7 +228,7 b' def sigs(ui, repo):' | |||||
223 | revs[r].extend(keys) |
|
228 | revs[r].extend(keys) | |
224 | for rev in sorted(revs, reverse=True): |
|
229 | for rev in sorted(revs, reverse=True): | |
225 | for k in revs[rev]: |
|
230 | for k in revs[rev]: | |
226 |
r = b"%5d:%s" % (rev, |
|
231 | r = b"%5d:%s" % (rev, hex(repo.changelog.node(rev))) | |
227 | ui.write(b"%-30s %s\n" % (keystr(ui, k), r)) |
|
232 | ui.write(b"%-30s %s\n" % (keystr(ui, k), r)) | |
228 |
|
233 | |||
229 |
|
234 | |||
@@ -232,7 +237,7 b' def sigcheck(ui, repo, rev):' | |||||
232 | """verify all the signatures there may be for a particular revision""" |
|
237 | """verify all the signatures there may be for a particular revision""" | |
233 | mygpg = newgpg(ui) |
|
238 | mygpg = newgpg(ui) | |
234 | rev = repo.lookup(rev) |
|
239 | rev = repo.lookup(rev) | |
235 |
hexrev = |
|
240 | hexrev = hex(rev) | |
236 | keys = [] |
|
241 | keys = [] | |
237 |
|
242 | |||
238 | for data, context in sigwalk(repo): |
|
243 | for data, context in sigwalk(repo): | |
@@ -243,11 +248,11 b' def sigcheck(ui, repo, rev):' | |||||
243 | keys.extend(k) |
|
248 | keys.extend(k) | |
244 |
|
249 | |||
245 | if not keys: |
|
250 | if not keys: | |
246 |
ui.write(_(b"no valid signature for %s\n") % |
|
251 | ui.write(_(b"no valid signature for %s\n") % short(rev)) | |
247 | return |
|
252 | return | |
248 |
|
253 | |||
249 | # print summary |
|
254 | # print summary | |
250 |
ui.write(_(b"%s is signed by:\n") % |
|
255 | ui.write(_(b"%s is signed by:\n") % short(rev)) | |
251 | for key in keys: |
|
256 | for key in keys: | |
252 | ui.write(b" %s\n" % keystr(ui, key)) |
|
257 | ui.write(b" %s\n" % keystr(ui, key)) | |
253 |
|
258 | |||
@@ -309,9 +314,7 b' def _dosign(ui, repo, *revs, **opts):' | |||||
309 | if revs: |
|
314 | if revs: | |
310 | nodes = [repo.lookup(n) for n in revs] |
|
315 | nodes = [repo.lookup(n) for n in revs] | |
311 | else: |
|
316 | else: | |
312 | nodes = [ |
|
317 | nodes = [node for node in repo.dirstate.parents() if node != nullid] | |
313 | node for node in repo.dirstate.parents() if node != hgnode.nullid |
|
|||
314 | ] |
|
|||
315 | if len(nodes) > 1: |
|
318 | if len(nodes) > 1: | |
316 | raise error.Abort( |
|
319 | raise error.Abort( | |
317 | _(b'uncommitted merge - please provide a specific revision') |
|
320 | _(b'uncommitted merge - please provide a specific revision') | |
@@ -320,10 +323,8 b' def _dosign(ui, repo, *revs, **opts):' | |||||
320 | nodes = [repo.changelog.tip()] |
|
323 | nodes = [repo.changelog.tip()] | |
321 |
|
324 | |||
322 | for n in nodes: |
|
325 | for n in nodes: | |
323 |
hexnode = |
|
326 | hexnode = hex(n) | |
324 | ui.write( |
|
327 | ui.write(_(b"signing %d:%s\n") % (repo.changelog.rev(n), short(n))) | |
325 | _(b"signing %d:%s\n") % (repo.changelog.rev(n), hgnode.short(n)) |
|
|||
326 | ) |
|
|||
327 | # build data |
|
328 | # build data | |
328 | data = node2txt(repo, n, sigver) |
|
329 | data = node2txt(repo, n, sigver) | |
329 | sig = mygpg.sign(data) |
|
330 | sig = mygpg.sign(data) | |
@@ -360,10 +361,7 b' def _dosign(ui, repo, *revs, **opts):' | |||||
360 | if not message: |
|
361 | if not message: | |
361 | # we don't translate commit messages |
|
362 | # we don't translate commit messages | |
362 | message = b"\n".join( |
|
363 | message = b"\n".join( | |
363 | [ |
|
364 | [b"Added signature for changeset %s" % short(n) for n in nodes] | |
364 | b"Added signature for changeset %s" % hgnode.short(n) |
|
|||
365 | for n in nodes |
|
|||
366 | ] |
|
|||
367 | ) |
|
365 | ) | |
368 | try: |
|
366 | try: | |
369 | editor = cmdutil.getcommiteditor( |
|
367 | editor = cmdutil.getcommiteditor( | |
@@ -379,7 +377,7 b' def _dosign(ui, repo, *revs, **opts):' | |||||
379 | def node2txt(repo, node, ver): |
|
377 | def node2txt(repo, node, ver): | |
380 | """map a manifest into some text""" |
|
378 | """map a manifest into some text""" | |
381 | if ver == b"0": |
|
379 | if ver == b"0": | |
382 |
return b"%s\n" % |
|
380 | return b"%s\n" % hex(node) | |
383 | else: |
|
381 | else: | |
384 | raise error.Abort(_(b"unknown signature version")) |
|
382 | raise error.Abort(_(b"unknown signature version")) | |
385 |
|
383 |
@@ -209,6 +209,11 b' from mercurial.pycompat import (' | |||||
209 | getattr, |
|
209 | getattr, | |
210 | open, |
|
210 | open, | |
211 | ) |
|
211 | ) | |
|
212 | from mercurial.node import ( | |||
|
213 | bin, | |||
|
214 | hex, | |||
|
215 | short, | |||
|
216 | ) | |||
212 | from mercurial import ( |
|
217 | from mercurial import ( | |
213 | bundle2, |
|
218 | bundle2, | |
214 | cmdutil, |
|
219 | cmdutil, | |
@@ -225,7 +230,6 b' from mercurial import (' | |||||
225 | merge as mergemod, |
|
230 | merge as mergemod, | |
226 | mergestate as mergestatemod, |
|
231 | mergestate as mergestatemod, | |
227 | mergeutil, |
|
232 | mergeutil, | |
228 | node, |
|
|||
229 | obsolete, |
|
233 | obsolete, | |
230 | pycompat, |
|
234 | pycompat, | |
231 | registrar, |
|
235 | registrar, | |
@@ -404,8 +408,8 b' class histeditstate(object):' | |||||
404 |
|
408 | |||
405 | def _write(self, fp): |
|
409 | def _write(self, fp): | |
406 | fp.write(b'v1\n') |
|
410 | fp.write(b'v1\n') | |
407 |
fp.write(b'%s\n' % |
|
411 | fp.write(b'%s\n' % hex(self.parentctxnode)) | |
408 |
fp.write(b'%s\n' % |
|
412 | fp.write(b'%s\n' % hex(self.topmost)) | |
409 | fp.write(b'%s\n' % (b'True' if self.keep else b'False')) |
|
413 | fp.write(b'%s\n' % (b'True' if self.keep else b'False')) | |
410 | fp.write(b'%d\n' % len(self.actions)) |
|
414 | fp.write(b'%d\n' % len(self.actions)) | |
411 | for action in self.actions: |
|
415 | for action in self.actions: | |
@@ -415,8 +419,8 b' class histeditstate(object):' | |||||
415 | fp.write( |
|
419 | fp.write( | |
416 | b'%s%s\n' |
|
420 | b'%s%s\n' | |
417 | % ( |
|
421 | % ( | |
418 |
|
|
422 | hex(replacement[0]), | |
419 |
b''.join( |
|
423 | b''.join(hex(r) for r in replacement[1]), | |
420 | ) |
|
424 | ) | |
421 | ) |
|
425 | ) | |
422 | backupfile = self.backupfile |
|
426 | backupfile = self.backupfile | |
@@ -432,10 +436,10 b' class histeditstate(object):' | |||||
432 | lines[index] # version number |
|
436 | lines[index] # version number | |
433 | index += 1 |
|
437 | index += 1 | |
434 |
|
438 | |||
435 |
parentctxnode = |
|
439 | parentctxnode = bin(lines[index]) | |
436 | index += 1 |
|
440 | index += 1 | |
437 |
|
441 | |||
438 |
topmost = |
|
442 | topmost = bin(lines[index]) | |
439 | index += 1 |
|
443 | index += 1 | |
440 |
|
444 | |||
441 | keep = lines[index] == b'True' |
|
445 | keep = lines[index] == b'True' | |
@@ -458,9 +462,9 b' class histeditstate(object):' | |||||
458 | index += 1 |
|
462 | index += 1 | |
459 | for i in pycompat.xrange(replacementlen): |
|
463 | for i in pycompat.xrange(replacementlen): | |
460 | replacement = lines[index] |
|
464 | replacement = lines[index] | |
461 |
original = |
|
465 | original = bin(replacement[:40]) | |
462 | succ = [ |
|
466 | succ = [ | |
463 |
|
|
467 | bin(replacement[i : i + 40]) | |
464 | for i in range(40, len(replacement), 40) |
|
468 | for i in range(40, len(replacement), 40) | |
465 | ] |
|
469 | ] | |
466 | replacements.append((original, succ)) |
|
470 | replacements.append((original, succ)) | |
@@ -494,12 +498,12 b' class histeditaction(object):' | |||||
494 | # ruleid can be anything from rev numbers, hashes, "bookmarks" etc |
|
498 | # ruleid can be anything from rev numbers, hashes, "bookmarks" etc | |
495 | # Check for validation of rule ids and get the rulehash |
|
499 | # Check for validation of rule ids and get the rulehash | |
496 | try: |
|
500 | try: | |
497 |
rev = |
|
501 | rev = bin(ruleid) | |
498 | except TypeError: |
|
502 | except TypeError: | |
499 | try: |
|
503 | try: | |
500 | _ctx = scmutil.revsingle(state.repo, ruleid) |
|
504 | _ctx = scmutil.revsingle(state.repo, ruleid) | |
501 | rulehash = _ctx.hex() |
|
505 | rulehash = _ctx.hex() | |
502 |
rev = |
|
506 | rev = bin(rulehash) | |
503 | except error.RepoLookupError: |
|
507 | except error.RepoLookupError: | |
504 | raise error.ParseError(_(b"invalid changeset %s") % ruleid) |
|
508 | raise error.ParseError(_(b"invalid changeset %s") % ruleid) | |
505 | return cls(state, rev) |
|
509 | return cls(state, rev) | |
@@ -507,7 +511,7 b' class histeditaction(object):' | |||||
507 | def verify(self, prev, expected, seen): |
|
511 | def verify(self, prev, expected, seen): | |
508 | """ Verifies semantic correctness of the rule""" |
|
512 | """ Verifies semantic correctness of the rule""" | |
509 | repo = self.repo |
|
513 | repo = self.repo | |
510 |
ha = |
|
514 | ha = hex(self.node) | |
511 | self.node = scmutil.resolvehexnodeidprefix(repo, ha) |
|
515 | self.node = scmutil.resolvehexnodeidprefix(repo, ha) | |
512 | if self.node is None: |
|
516 | if self.node is None: | |
513 | raise error.ParseError(_(b'unknown changeset %s listed') % ha[:12]) |
|
517 | raise error.ParseError(_(b'unknown changeset %s listed') % ha[:12]) | |
@@ -518,14 +522,13 b' class histeditaction(object):' | |||||
518 | if self.node not in expected: |
|
522 | if self.node not in expected: | |
519 | raise error.ParseError( |
|
523 | raise error.ParseError( | |
520 | _(b'%s "%s" changeset was not a candidate') |
|
524 | _(b'%s "%s" changeset was not a candidate') | |
521 |
% (self.verb, |
|
525 | % (self.verb, short(self.node)), | |
522 | hint=_(b'only use listed changesets'), |
|
526 | hint=_(b'only use listed changesets'), | |
523 | ) |
|
527 | ) | |
524 | # and only one command per node |
|
528 | # and only one command per node | |
525 | if self.node in seen: |
|
529 | if self.node in seen: | |
526 | raise error.ParseError( |
|
530 | raise error.ParseError( | |
527 | _(b'duplicated command for changeset %s') |
|
531 | _(b'duplicated command for changeset %s') % short(self.node) | |
528 | % node.short(self.node) |
|
|||
529 | ) |
|
532 | ) | |
530 |
|
533 | |||
531 | def torule(self): |
|
534 | def torule(self): | |
@@ -557,7 +560,7 b' class histeditaction(object):' | |||||
557 | """Print an action in format used by histedit state files |
|
560 | """Print an action in format used by histedit state files | |
558 | (the first line is a verb, the remainder is the second) |
|
561 | (the first line is a verb, the remainder is the second) | |
559 | """ |
|
562 | """ | |
560 |
return b"%s\n%s" % (self.verb, |
|
563 | return b"%s\n%s" % (self.verb, hex(self.node)) | |
561 |
|
564 | |||
562 | def run(self): |
|
565 | def run(self): | |
563 | """Runs the action. The default behavior is simply apply the action's |
|
566 | """Runs the action. The default behavior is simply apply the action's | |
@@ -578,8 +581,7 b' class histeditaction(object):' | |||||
578 | repo.dirstate.setbranch(rulectx.branch()) |
|
581 | repo.dirstate.setbranch(rulectx.branch()) | |
579 | if stats.unresolvedcount: |
|
582 | if stats.unresolvedcount: | |
580 | raise error.InterventionRequired( |
|
583 | raise error.InterventionRequired( | |
581 | _(b'Fix up the change (%s %s)') |
|
584 | _(b'Fix up the change (%s %s)') % (self.verb, short(self.node)), | |
582 | % (self.verb, node.short(self.node)), |
|
|||
583 | hint=_(b'hg histedit --continue to resume'), |
|
585 | hint=_(b'hg histedit --continue to resume'), | |
584 | ) |
|
586 | ) | |
585 |
|
587 | |||
@@ -614,8 +616,7 b' class histeditaction(object):' | |||||
614 | ctx = self.repo[b'.'] |
|
616 | ctx = self.repo[b'.'] | |
615 | if ctx.node() == self.state.parentctxnode: |
|
617 | if ctx.node() == self.state.parentctxnode: | |
616 | self.repo.ui.warn( |
|
618 | self.repo.ui.warn( | |
617 | _(b'%s: skipping changeset (no changes)\n') |
|
619 | _(b'%s: skipping changeset (no changes)\n') % short(self.node) | |
618 | % node.short(self.node) |
|
|||
619 | ) |
|
620 | ) | |
620 | return ctx, [(self.node, tuple())] |
|
621 | return ctx, [(self.node, tuple())] | |
621 | if ctx.node() == self.node: |
|
622 | if ctx.node() == self.node: | |
@@ -684,7 +685,7 b' def collapse(repo, firstctx, lastctx, co' | |||||
684 | for c in ctxs: |
|
685 | for c in ctxs: | |
685 | if not c.mutable(): |
|
686 | if not c.mutable(): | |
686 | raise error.ParseError( |
|
687 | raise error.ParseError( | |
687 |
_(b"cannot fold into public change %s") % |
|
688 | _(b"cannot fold into public change %s") % short(c.node()) | |
688 | ) |
|
689 | ) | |
689 | base = firstctx.p1() |
|
690 | base = firstctx.p1() | |
690 |
|
691 | |||
@@ -786,13 +787,17 b' class pick(histeditaction):' | |||||
786 | def run(self): |
|
787 | def run(self): | |
787 | rulectx = self.repo[self.node] |
|
788 | rulectx = self.repo[self.node] | |
788 | if rulectx.p1().node() == self.state.parentctxnode: |
|
789 | if rulectx.p1().node() == self.state.parentctxnode: | |
789 |
self.repo.ui.debug(b'node %s unchanged\n' % |
|
790 | self.repo.ui.debug(b'node %s unchanged\n' % short(self.node)) | |
790 | return rulectx, [] |
|
791 | return rulectx, [] | |
791 |
|
792 | |||
792 | return super(pick, self).run() |
|
793 | return super(pick, self).run() | |
793 |
|
794 | |||
794 |
|
795 | |||
795 | @action([b'edit', b'e'], _(b'use commit, but allow edits before making new commit'), priority=True) |
|
796 | @action( | |
|
797 | [b'edit', b'e'], | |||
|
798 | _(b'use commit, but allow edits before making new commit'), | |||
|
799 | priority=True, | |||
|
800 | ) | |||
796 | class edit(histeditaction): |
|
801 | class edit(histeditaction): | |
797 | def run(self): |
|
802 | def run(self): | |
798 | repo = self.repo |
|
803 | repo = self.repo | |
@@ -802,8 +807,8 b' class edit(histeditaction):' | |||||
802 | hint = _(b'to edit %s, `hg histedit --continue` after making changes') |
|
807 | hint = _(b'to edit %s, `hg histedit --continue` after making changes') | |
803 | raise error.InterventionRequired( |
|
808 | raise error.InterventionRequired( | |
804 | _(b'Editing (%s), commit as needed now to split the change') |
|
809 | _(b'Editing (%s), commit as needed now to split the change') | |
805 |
% |
|
810 | % short(self.node), | |
806 |
hint=hint % |
|
811 | hint=hint % short(self.node), | |
807 | ) |
|
812 | ) | |
808 |
|
813 | |||
809 | def commiteditor(self): |
|
814 | def commiteditor(self): | |
@@ -824,7 +829,7 b' class fold(histeditaction):' | |||||
824 | c = repo[prev.node] |
|
829 | c = repo[prev.node] | |
825 | if not c.mutable(): |
|
830 | if not c.mutable(): | |
826 | raise error.ParseError( |
|
831 | raise error.ParseError( | |
827 |
_(b"cannot fold into public change %s") % |
|
832 | _(b"cannot fold into public change %s") % short(c.node()) | |
828 | ) |
|
833 | ) | |
829 |
|
834 | |||
830 | def continuedirty(self): |
|
835 | def continuedirty(self): | |
@@ -833,7 +838,7 b' class fold(histeditaction):' | |||||
833 |
|
838 | |||
834 | commit = commitfuncfor(repo, rulectx) |
|
839 | commit = commitfuncfor(repo, rulectx) | |
835 | commit( |
|
840 | commit( | |
836 |
text=b'fold-temp-revision %s' % |
|
841 | text=b'fold-temp-revision %s' % short(self.node), | |
837 | user=rulectx.user(), |
|
842 | user=rulectx.user(), | |
838 | date=rulectx.date(), |
|
843 | date=rulectx.date(), | |
839 | extra=rulectx.extra(), |
|
844 | extra=rulectx.extra(), | |
@@ -845,7 +850,7 b' class fold(histeditaction):' | |||||
845 | rulectx = repo[self.node] |
|
850 | rulectx = repo[self.node] | |
846 | parentctxnode = self.state.parentctxnode |
|
851 | parentctxnode = self.state.parentctxnode | |
847 | if ctx.node() == parentctxnode: |
|
852 | if ctx.node() == parentctxnode: | |
848 |
repo.ui.warn(_(b'%s: empty changeset\n') % |
|
853 | repo.ui.warn(_(b'%s: empty changeset\n') % short(self.node)) | |
849 | return ctx, [(self.node, (parentctxnode,))] |
|
854 | return ctx, [(self.node, (parentctxnode,))] | |
850 |
|
855 | |||
851 | parentctx = repo[parentctxnode] |
|
856 | parentctx = repo[parentctxnode] | |
@@ -859,7 +864,7 b' class fold(histeditaction):' | |||||
859 | b'%s: cannot fold - working copy is not a ' |
|
864 | b'%s: cannot fold - working copy is not a ' | |
860 | b'descendant of previous commit %s\n' |
|
865 | b'descendant of previous commit %s\n' | |
861 | ) |
|
866 | ) | |
862 |
% ( |
|
867 | % (short(self.node), short(parentctxnode)) | |
863 | ) |
|
868 | ) | |
864 | return ctx, [(self.node, (ctx.node(),))] |
|
869 | return ctx, [(self.node, (ctx.node(),))] | |
865 |
|
870 | |||
@@ -973,7 +978,7 b' class base(histeditaction):' | |||||
973 | if self.node in expected: |
|
978 | if self.node in expected: | |
974 | msg = _(b'%s "%s" changeset was an edited list candidate') |
|
979 | msg = _(b'%s "%s" changeset was an edited list candidate') | |
975 | raise error.ParseError( |
|
980 | raise error.ParseError( | |
976 |
msg % (self.verb, |
|
981 | msg % (self.verb, short(self.node)), | |
977 | hint=_(b'base must only use unlisted changesets'), |
|
982 | hint=_(b'base must only use unlisted changesets'), | |
978 | ) |
|
983 | ) | |
979 |
|
984 | |||
@@ -1717,8 +1722,7 b' def _chistedit(ui, repo, freeargs, opts)' | |||||
1717 | revs = between(repo, root, topmost, keep) |
|
1722 | revs = between(repo, root, topmost, keep) | |
1718 | if not revs: |
|
1723 | if not revs: | |
1719 | raise error.Abort( |
|
1724 | raise error.Abort( | |
1720 | _(b'%s is not an ancestor of working directory') |
|
1725 | _(b'%s is not an ancestor of working directory') % short(root) | |
1721 | % node.short(root) |
|
|||
1722 | ) |
|
1726 | ) | |
1723 |
|
1727 | |||
1724 | ctxs = [] |
|
1728 | ctxs = [] | |
@@ -2071,16 +2075,16 b' def _finishhistedit(ui, repo, state, fm)' | |||||
2071 | if mapping: |
|
2075 | if mapping: | |
2072 | for prec, succs in pycompat.iteritems(mapping): |
|
2076 | for prec, succs in pycompat.iteritems(mapping): | |
2073 | if not succs: |
|
2077 | if not succs: | |
2074 |
ui.debug(b'histedit: %s is dropped\n' % |
|
2078 | ui.debug(b'histedit: %s is dropped\n' % short(prec)) | |
2075 | else: |
|
2079 | else: | |
2076 | ui.debug( |
|
2080 | ui.debug( | |
2077 | b'histedit: %s is replaced by %s\n' |
|
2081 | b'histedit: %s is replaced by %s\n' | |
2078 |
% ( |
|
2082 | % (short(prec), short(succs[0])) | |
2079 | ) |
|
2083 | ) | |
2080 | if len(succs) > 1: |
|
2084 | if len(succs) > 1: | |
2081 | m = b'histedit: %s' |
|
2085 | m = b'histedit: %s' | |
2082 | for n in succs[1:]: |
|
2086 | for n in succs[1:]: | |
2083 |
ui.debug(m % |
|
2087 | ui.debug(m % short(n)) | |
2084 |
|
2088 | |||
2085 | if not state.keep: |
|
2089 | if not state.keep: | |
2086 | if mapping: |
|
2090 | if mapping: | |
@@ -2125,7 +2129,7 b' def _aborthistedit(ui, repo, state, noba' | |||||
2125 | try: |
|
2129 | try: | |
2126 | state.read() |
|
2130 | state.read() | |
2127 | __, leafs, tmpnodes, __ = processreplacement(state) |
|
2131 | __, leafs, tmpnodes, __ = processreplacement(state) | |
2128 |
ui.debug(b'restore wc to old parent %s\n' % |
|
2132 | ui.debug(b'restore wc to old parent %s\n' % short(state.topmost)) | |
2129 |
|
2133 | |||
2130 | # Recover our old commits if necessary |
|
2134 | # Recover our old commits if necessary | |
2131 | if not state.topmost in repo and state.backupfile: |
|
2135 | if not state.topmost in repo and state.backupfile: | |
@@ -2179,7 +2183,7 b' def _edithisteditplan(ui, repo, state, r' | |||||
2179 | state.read() |
|
2183 | state.read() | |
2180 | if not rules: |
|
2184 | if not rules: | |
2181 | comment = geteditcomment( |
|
2185 | comment = geteditcomment( | |
2182 |
ui, |
|
2186 | ui, short(state.parentctxnode), short(state.topmost) | |
2183 | ) |
|
2187 | ) | |
2184 | rules = ruleeditor(repo, ui, state.actions, comment) |
|
2188 | rules = ruleeditor(repo, ui, state.actions, comment) | |
2185 | else: |
|
2189 | else: | |
@@ -2220,7 +2224,7 b' def _newhistedit(ui, repo, state, revs, ' | |||||
2220 | revs = between(repo, root, topmost, state.keep) |
|
2224 | revs = between(repo, root, topmost, state.keep) | |
2221 | if not revs: |
|
2225 | if not revs: | |
2222 | raise error.Abort( |
|
2226 | raise error.Abort( | |
2223 |
_(b'%s is not an ancestor of working directory') % |
|
2227 | _(b'%s is not an ancestor of working directory') % short(root) | |
2224 | ) |
|
2228 | ) | |
2225 |
|
2229 | |||
2226 | ctxs = [repo[r] for r in revs] |
|
2230 | ctxs = [repo[r] for r in revs] | |
@@ -2257,7 +2261,7 b' def _newhistedit(ui, repo, state, revs, ' | |||||
2257 | ) |
|
2261 | ) | |
2258 |
|
2262 | |||
2259 | if not rules: |
|
2263 | if not rules: | |
2260 |
comment = geteditcomment(ui, |
|
2264 | comment = geteditcomment(ui, short(root), short(topmost)) | |
2261 | actions = [pick(state, r) for r in revs] |
|
2265 | actions = [pick(state, r) for r in revs] | |
2262 | rules = ruleeditor(repo, ui, actions, comment) |
|
2266 | rules = ruleeditor(repo, ui, actions, comment) | |
2263 | else: |
|
2267 | else: | |
@@ -2461,12 +2465,12 b' def verifyactions(actions, state, ctxs):' | |||||
2461 | actions[:0] = drops |
|
2465 | actions[:0] = drops | |
2462 | elif missing: |
|
2466 | elif missing: | |
2463 | raise error.ParseError( |
|
2467 | raise error.ParseError( | |
2464 |
_(b'missing rules for changeset %s') % |
|
2468 | _(b'missing rules for changeset %s') % short(missing[0]), | |
2465 | hint=_( |
|
2469 | hint=_( | |
2466 | b'use "drop %s" to discard, see also: ' |
|
2470 | b'use "drop %s" to discard, see also: ' | |
2467 | b"'hg help -e histedit.config'" |
|
2471 | b"'hg help -e histedit.config'" | |
2468 | ) |
|
2472 | ) | |
2469 |
% |
|
2473 | % short(missing[0]), | |
2470 | ) |
|
2474 | ) | |
2471 |
|
2475 | |||
2472 |
|
2476 | |||
@@ -2620,7 +2624,7 b' def stripwrapper(orig, ui, repo, nodelis' | |||||
2620 | if common_nodes: |
|
2624 | if common_nodes: | |
2621 | raise error.Abort( |
|
2625 | raise error.Abort( | |
2622 | _(b"histedit in progress, can't strip %s") |
|
2626 | _(b"histedit in progress, can't strip %s") | |
2623 |
% b', '.join( |
|
2627 | % b', '.join(short(x) for x in common_nodes) | |
2624 | ) |
|
2628 | ) | |
2625 | return orig(ui, repo, nodelist, *args, **kwargs) |
|
2629 | return orig(ui, repo, nodelist, *args, **kwargs) | |
2626 |
|
2630 |
@@ -6,13 +6,13 b'' | |||||
6 | from __future__ import absolute_import |
|
6 | from __future__ import absolute_import | |
7 |
|
7 | |||
8 | from mercurial.i18n import _ |
|
8 | from mercurial.i18n import _ | |
|
9 | from mercurial.node import hex | |||
9 |
|
10 | |||
10 | from mercurial import ( |
|
11 | from mercurial import ( | |
11 | bundle2, |
|
12 | bundle2, | |
12 | changegroup, |
|
13 | changegroup, | |
13 | error, |
|
14 | error, | |
14 | extensions, |
|
15 | extensions, | |
15 | node as nodemod, |
|
|||
16 | pycompat, |
|
16 | pycompat, | |
17 | revsetlang, |
|
17 | revsetlang, | |
18 | util, |
|
18 | util, | |
@@ -54,7 +54,7 b' def getscratchbranchparts(repo, peer, ou' | |||||
54 | params[b'bookprevnode'] = b'' |
|
54 | params[b'bookprevnode'] = b'' | |
55 | bookmarks = repo._bookmarks |
|
55 | bookmarks = repo._bookmarks | |
56 | if bookmark in bookmarks: |
|
56 | if bookmark in bookmarks: | |
57 |
params[b'bookprevnode'] = |
|
57 | params[b'bookprevnode'] = hex(bookmarks[bookmark]) | |
58 |
|
58 | |||
59 | # Do not send pushback bundle2 part with bookmarks if remotenames extension |
|
59 | # Do not send pushback bundle2 part with bookmarks if remotenames extension | |
60 | # is enabled. It will be handled manually in `_push()` |
|
60 | # is enabled. It will be handled manually in `_push()` |
@@ -9,11 +9,9 b' import abc' | |||||
9 | import os |
|
9 | import os | |
10 | import subprocess |
|
10 | import subprocess | |
11 |
|
11 | |||
|
12 | from mercurial.node import hex | |||
12 | from mercurial.pycompat import open |
|
13 | from mercurial.pycompat import open | |
13 |
from mercurial import |
|
14 | from mercurial import pycompat | |
14 | node, |
|
|||
15 | pycompat, |
|
|||
16 | ) |
|
|||
17 | from mercurial.utils import ( |
|
15 | from mercurial.utils import ( | |
18 | hashutil, |
|
16 | hashutil, | |
19 | procutil, |
|
17 | procutil, | |
@@ -86,7 +84,7 b' class filebundlestore(object):' | |||||
86 | return os.path.join(self._dirpath(filename), filename) |
|
84 | return os.path.join(self._dirpath(filename), filename) | |
87 |
|
85 | |||
88 | def write(self, data): |
|
86 | def write(self, data): | |
89 |
filename = |
|
87 | filename = hex(hashutil.sha1(data).digest()) | |
90 | dirpath = self._dirpath(filename) |
|
88 | dirpath = self._dirpath(filename) | |
91 |
|
89 | |||
92 | if not os.path.exists(dirpath): |
|
90 | if not os.path.exists(dirpath): |
@@ -19,6 +19,11 b' import os' | |||||
19 | import weakref |
|
19 | import weakref | |
20 |
|
20 | |||
21 | from mercurial.i18n import _ |
|
21 | from mercurial.i18n import _ | |
|
22 | from mercurial.node import ( | |||
|
23 | bin, | |||
|
24 | hex, | |||
|
25 | nullid, | |||
|
26 | ) | |||
22 |
|
27 | |||
23 | from mercurial import ( |
|
28 | from mercurial import ( | |
24 | bookmarks, |
|
29 | bookmarks, | |
@@ -31,7 +36,6 b' from mercurial import (' | |||||
31 | localrepo, |
|
36 | localrepo, | |
32 | lock, |
|
37 | lock, | |
33 | logcmdutil, |
|
38 | logcmdutil, | |
34 | node, |
|
|||
35 | pycompat, |
|
39 | pycompat, | |
36 | registrar, |
|
40 | registrar, | |
37 | util, |
|
41 | util, | |
@@ -113,8 +117,8 b' def recorddirstateparents(dirstate, old,' | |||||
113 | new = list(new) |
|
117 | new = list(new) | |
114 | if util.safehasattr(dirstate, 'journalstorage'): |
|
118 | if util.safehasattr(dirstate, 'journalstorage'): | |
115 | # only record two hashes if there was a merge |
|
119 | # only record two hashes if there was a merge | |
116 |
oldhashes = old[:1] if old[1] == |
|
120 | oldhashes = old[:1] if old[1] == nullid else old | |
117 |
newhashes = new[:1] if new[1] == |
|
121 | newhashes = new[:1] if new[1] == nullid else new | |
118 | dirstate.journalstorage.record( |
|
122 | dirstate.journalstorage.record( | |
119 | wdirparenttype, b'.', oldhashes, newhashes |
|
123 | wdirparenttype, b'.', oldhashes, newhashes | |
120 | ) |
|
124 | ) | |
@@ -127,7 +131,7 b' def recordbookmarks(orig, store, fp):' | |||||
127 | if util.safehasattr(repo, 'journal'): |
|
131 | if util.safehasattr(repo, 'journal'): | |
128 | oldmarks = bookmarks.bmstore(repo) |
|
132 | oldmarks = bookmarks.bmstore(repo) | |
129 | for mark, value in pycompat.iteritems(store): |
|
133 | for mark, value in pycompat.iteritems(store): | |
130 |
oldvalue = oldmarks.get(mark, |
|
134 | oldvalue = oldmarks.get(mark, nullid) | |
131 | if value != oldvalue: |
|
135 | if value != oldvalue: | |
132 | repo.journal.record(bookmarktype, mark, oldvalue, value) |
|
136 | repo.journal.record(bookmarktype, mark, oldvalue, value) | |
133 | return orig(store, fp) |
|
137 | return orig(store, fp) | |
@@ -248,8 +252,8 b' class journalentry(' | |||||
248 | ) = line.split(b'\n') |
|
252 | ) = line.split(b'\n') | |
249 | timestamp, tz = time.split() |
|
253 | timestamp, tz = time.split() | |
250 | timestamp, tz = float(timestamp), int(tz) |
|
254 | timestamp, tz = float(timestamp), int(tz) | |
251 |
oldhashes = tuple( |
|
255 | oldhashes = tuple(bin(hash) for hash in oldhashes.split(b',')) | |
252 |
newhashes = tuple( |
|
256 | newhashes = tuple(bin(hash) for hash in newhashes.split(b',')) | |
253 | return cls( |
|
257 | return cls( | |
254 | (timestamp, tz), |
|
258 | (timestamp, tz), | |
255 | user, |
|
259 | user, | |
@@ -263,8 +267,8 b' class journalentry(' | |||||
263 | def __bytes__(self): |
|
267 | def __bytes__(self): | |
264 | """bytes representation for storage""" |
|
268 | """bytes representation for storage""" | |
265 | time = b' '.join(map(pycompat.bytestr, self.timestamp)) |
|
269 | time = b' '.join(map(pycompat.bytestr, self.timestamp)) | |
266 |
oldhashes = b','.join([ |
|
270 | oldhashes = b','.join([hex(hash) for hash in self.oldhashes]) | |
267 |
newhashes = b','.join([ |
|
271 | newhashes = b','.join([hex(hash) for hash in self.newhashes]) | |
268 | return b'\n'.join( |
|
272 | return b'\n'.join( | |
269 | ( |
|
273 | ( | |
270 | time, |
|
274 | time, |
@@ -14,6 +14,11 b' import os' | |||||
14 | import shutil |
|
14 | import shutil | |
15 |
|
15 | |||
16 | from mercurial.i18n import _ |
|
16 | from mercurial.i18n import _ | |
|
17 | from mercurial.node import ( | |||
|
18 | bin, | |||
|
19 | hex, | |||
|
20 | nullid, | |||
|
21 | ) | |||
17 |
|
22 | |||
18 | from mercurial import ( |
|
23 | from mercurial import ( | |
19 | cmdutil, |
|
24 | cmdutil, | |
@@ -23,7 +28,6 b' from mercurial import (' | |||||
23 | hg, |
|
28 | hg, | |
24 | lock, |
|
29 | lock, | |
25 | match as matchmod, |
|
30 | match as matchmod, | |
26 | node, |
|
|||
27 | pycompat, |
|
31 | pycompat, | |
28 | scmutil, |
|
32 | scmutil, | |
29 | util, |
|
33 | util, | |
@@ -111,7 +115,7 b' def lfconvert(ui, src, dest, *pats, **op' | |||||
111 | rsrc[ctx] |
|
115 | rsrc[ctx] | |
112 | for ctx in rsrc.changelog.nodesbetween(None, rsrc.heads())[0] |
|
116 | for ctx in rsrc.changelog.nodesbetween(None, rsrc.heads())[0] | |
113 | ) |
|
117 | ) | |
114 |
revmap = { |
|
118 | revmap = {nullid: nullid} | |
115 | if tolfile: |
|
119 | if tolfile: | |
116 | # Lock destination to prevent modification while it is converted to. |
|
120 | # Lock destination to prevent modification while it is converted to. | |
117 | # Don't need to lock src because we are just reading from its |
|
121 | # Don't need to lock src because we are just reading from its | |
@@ -275,7 +279,7 b' def _lfconvert_addchangeset(' | |||||
275 | # largefile was modified, update standins |
|
279 | # largefile was modified, update standins | |
276 | m = hashutil.sha1(b'') |
|
280 | m = hashutil.sha1(b'') | |
277 | m.update(ctx[f].data()) |
|
281 | m.update(ctx[f].data()) | |
278 |
hash = |
|
282 | hash = hex(m.digest()) | |
279 | if f not in lfiletohash or lfiletohash[f] != hash: |
|
283 | if f not in lfiletohash or lfiletohash[f] != hash: | |
280 | rdst.wwrite(f, ctx[f].data(), ctx[f].flags()) |
|
284 | rdst.wwrite(f, ctx[f].data(), ctx[f].flags()) | |
281 | executable = b'x' in ctx[f].flags() |
|
285 | executable = b'x' in ctx[f].flags() | |
@@ -336,7 +340,7 b' def _commitcontext(rdst, parents, ctx, d' | |||||
336 | # Generate list of changed files |
|
340 | # Generate list of changed files | |
337 | def _getchangedfiles(ctx, parents): |
|
341 | def _getchangedfiles(ctx, parents): | |
338 | files = set(ctx.files()) |
|
342 | files = set(ctx.files()) | |
339 |
if |
|
343 | if nullid not in parents: | |
340 | mc = ctx.manifest() |
|
344 | mc = ctx.manifest() | |
341 | for pctx in ctx.parents(): |
|
345 | for pctx in ctx.parents(): | |
342 | for fn in pctx.manifest().diff(mc): |
|
346 | for fn in pctx.manifest().diff(mc): | |
@@ -350,7 +354,7 b' def _convertparents(ctx, revmap):' | |||||
350 | for p in ctx.parents(): |
|
354 | for p in ctx.parents(): | |
351 | parents.append(revmap[p.node()]) |
|
355 | parents.append(revmap[p.node()]) | |
352 | while len(parents) < 2: |
|
356 | while len(parents) < 2: | |
353 |
parents.append( |
|
357 | parents.append(nullid) | |
354 | return parents |
|
358 | return parents | |
355 |
|
359 | |||
356 |
|
360 | |||
@@ -380,12 +384,12 b' def _converttags(ui, revmap, data):' | |||||
380 | ui.warn(_(b'skipping incorrectly formatted tag %s\n') % line) |
|
384 | ui.warn(_(b'skipping incorrectly formatted tag %s\n') % line) | |
381 | continue |
|
385 | continue | |
382 | try: |
|
386 | try: | |
383 |
newid = |
|
387 | newid = bin(id) | |
384 | except TypeError: |
|
388 | except TypeError: | |
385 | ui.warn(_(b'skipping incorrectly formatted id %s\n') % id) |
|
389 | ui.warn(_(b'skipping incorrectly formatted id %s\n') % id) | |
386 | continue |
|
390 | continue | |
387 | try: |
|
391 | try: | |
388 |
newdata.append(b'%s %s\n' % ( |
|
392 | newdata.append(b'%s %s\n' % (hex(revmap[newid]), name)) | |
389 | except KeyError: |
|
393 | except KeyError: | |
390 | ui.warn(_(b'no mapping for id %s\n') % id) |
|
394 | ui.warn(_(b'no mapping for id %s\n') % id) | |
391 | continue |
|
395 | continue |
@@ -15,7 +15,10 b' import os' | |||||
15 | import stat |
|
15 | import stat | |
16 |
|
16 | |||
17 | from mercurial.i18n import _ |
|
17 | from mercurial.i18n import _ | |
18 |
from mercurial.node import |
|
18 | from mercurial.node import ( | |
|
19 | hex, | |||
|
20 | nullid, | |||
|
21 | ) | |||
19 | from mercurial.pycompat import open |
|
22 | from mercurial.pycompat import open | |
20 |
|
23 | |||
21 | from mercurial import ( |
|
24 | from mercurial import ( | |
@@ -24,7 +27,6 b' from mercurial import (' | |||||
24 | error, |
|
27 | error, | |
25 | httpconnection, |
|
28 | httpconnection, | |
26 | match as matchmod, |
|
29 | match as matchmod, | |
27 | node, |
|
|||
28 | pycompat, |
|
30 | pycompat, | |
29 | scmutil, |
|
31 | scmutil, | |
30 | sparse, |
|
32 | sparse, | |
@@ -610,7 +612,7 b' def getlfilestoupload(repo, missing, add' | |||||
610 | ) as progress: |
|
612 | ) as progress: | |
611 | for i, n in enumerate(missing): |
|
613 | for i, n in enumerate(missing): | |
612 | progress.update(i) |
|
614 | progress.update(i) | |
613 |
parents = [p for p in repo[n].parents() if p != |
|
615 | parents = [p for p in repo[n].parents() if p != nullid] | |
614 |
|
616 | |||
615 | with lfstatus(repo, value=False): |
|
617 | with lfstatus(repo, value=False): | |
616 | ctx = repo[n] |
|
618 | ctx = repo[n] |
@@ -125,6 +125,7 b' from __future__ import absolute_import' | |||||
125 | import sys |
|
125 | import sys | |
126 |
|
126 | |||
127 | from mercurial.i18n import _ |
|
127 | from mercurial.i18n import _ | |
|
128 | from mercurial.node import bin | |||
128 |
|
129 | |||
129 | from mercurial import ( |
|
130 | from mercurial import ( | |
130 | bundlecaches, |
|
131 | bundlecaches, | |
@@ -137,7 +138,6 b' from mercurial import (' | |||||
137 | filesetlang, |
|
138 | filesetlang, | |
138 | localrepo, |
|
139 | localrepo, | |
139 | minifileset, |
|
140 | minifileset, | |
140 | node, |
|
|||
141 | pycompat, |
|
141 | pycompat, | |
142 | revlog, |
|
142 | revlog, | |
143 | scmutil, |
|
143 | scmutil, | |
@@ -260,11 +260,10 b' def _reposetup(ui, repo):' | |||||
260 | return 0 |
|
260 | return 0 | |
261 |
|
261 | |||
262 | last = kwargs.get('node_last') |
|
262 | last = kwargs.get('node_last') | |
263 | _bin = node.bin |
|
|||
264 | if last: |
|
263 | if last: | |
265 |
s = repo.set(b'%n:%n', |
|
264 | s = repo.set(b'%n:%n', bin(kwargs['node']), bin(last)) | |
266 | else: |
|
265 | else: | |
267 |
s = repo.set(b'%n', |
|
266 | s = repo.set(b'%n', bin(kwargs['node'])) | |
268 | match = repo._storenarrowmatch |
|
267 | match = repo._storenarrowmatch | |
269 | for ctx in s: |
|
268 | for ctx in s: | |
270 | # TODO: is there a way to just walk the files in the commit? |
|
269 | # TODO: is there a way to just walk the files in the commit? |
@@ -17,12 +17,12 b' import socket' | |||||
17 |
|
17 | |||
18 | from mercurial.i18n import _ |
|
18 | from mercurial.i18n import _ | |
19 | from mercurial.pycompat import getattr |
|
19 | from mercurial.pycompat import getattr | |
|
20 | from mercurial.node import hex | |||
20 |
|
21 | |||
21 | from mercurial import ( |
|
22 | from mercurial import ( | |
22 | encoding, |
|
23 | encoding, | |
23 | error, |
|
24 | error, | |
24 | httpconnection as httpconnectionmod, |
|
25 | httpconnection as httpconnectionmod, | |
25 | node, |
|
|||
26 | pathutil, |
|
26 | pathutil, | |
27 | pycompat, |
|
27 | pycompat, | |
28 | url as urlmod, |
|
28 | url as urlmod, | |
@@ -173,7 +173,7 b' class local(object):' | |||||
173 | ) |
|
173 | ) | |
174 | raise LfsRemoteError(_(msg) % (size, int(content_length))) |
|
174 | raise LfsRemoteError(_(msg) % (size, int(content_length))) | |
175 |
|
175 | |||
176 |
realoid = |
|
176 | realoid = hex(sha256.digest()) | |
177 | if realoid != oid: |
|
177 | if realoid != oid: | |
178 | raise LfsCorruptionError( |
|
178 | raise LfsCorruptionError( | |
179 | _(b'corrupt remote lfs object: %s') % oid |
|
179 | _(b'corrupt remote lfs object: %s') % oid | |
@@ -224,7 +224,7 b' class local(object):' | |||||
224 | # Don't abort if corruption is detected, because `hg verify` will |
|
224 | # Don't abort if corruption is detected, because `hg verify` will | |
225 | # give more useful info about the corruption- simply don't add the |
|
225 | # give more useful info about the corruption- simply don't add the | |
226 | # hardlink. |
|
226 | # hardlink. | |
227 |
if verify or |
|
227 | if verify or hex(hashlib.sha256(blob).digest()) == oid: | |
228 | self.ui.note(_(b'lfs: found %s in the usercache\n') % oid) |
|
228 | self.ui.note(_(b'lfs: found %s in the usercache\n') % oid) | |
229 | lfutil.link(self.cachevfs.join(oid), self.vfs.join(oid)) |
|
229 | lfutil.link(self.cachevfs.join(oid), self.vfs.join(oid)) | |
230 | else: |
|
230 | else: | |
@@ -248,7 +248,7 b' class local(object):' | |||||
248 | for chunk in util.filechunkiter(fp, size=1048576): |
|
248 | for chunk in util.filechunkiter(fp, size=1048576): | |
249 | sha256.update(chunk) |
|
249 | sha256.update(chunk) | |
250 |
|
250 | |||
251 |
return oid == |
|
251 | return oid == hex(sha256.digest()) | |
252 |
|
252 | |||
253 | def has(self, oid): |
|
253 | def has(self, oid): | |
254 | """Returns True if the local blobstore contains the requested blob, |
|
254 | """Returns True if the local blobstore contains the requested blob, | |
@@ -706,7 +706,7 b' def _deduplicate(pointers):' | |||||
706 |
|
706 | |||
707 |
|
707 | |||
708 | def _verify(oid, content): |
|
708 | def _verify(oid, content): | |
709 |
realoid = |
|
709 | realoid = hex(hashlib.sha256(content).digest()) | |
710 | if realoid != oid: |
|
710 | if realoid != oid: | |
711 | raise LfsCorruptionError( |
|
711 | raise LfsCorruptionError( | |
712 | _(b'detected corrupt lfs object: %s') % oid, |
|
712 | _(b'detected corrupt lfs object: %s') % oid, |
@@ -10,6 +10,11 b' import itertools' | |||||
10 | import os |
|
10 | import os | |
11 |
|
11 | |||
12 | from mercurial.i18n import _ |
|
12 | from mercurial.i18n import _ | |
|
13 | from mercurial.node import ( | |||
|
14 | hex, | |||
|
15 | nullid, | |||
|
16 | short, | |||
|
17 | ) | |||
13 | from mercurial import ( |
|
18 | from mercurial import ( | |
14 | bundle2, |
|
19 | bundle2, | |
15 | cmdutil, |
|
20 | cmdutil, | |
@@ -21,7 +26,6 b' from mercurial import (' | |||||
21 | extensions, |
|
26 | extensions, | |
22 | hg, |
|
27 | hg, | |
23 | narrowspec, |
|
28 | narrowspec, | |
24 | node, |
|
|||
25 | pathutil, |
|
29 | pathutil, | |
26 | pycompat, |
|
30 | pycompat, | |
27 | registrar, |
|
31 | registrar, | |
@@ -184,9 +188,9 b' def pullbundle2extraprepare(orig, pullop' | |||||
184 | # we have all the nodes |
|
188 | # we have all the nodes | |
185 | if wireprototypes.ELLIPSESCAP1 in pullop.remote.capabilities(): |
|
189 | if wireprototypes.ELLIPSESCAP1 in pullop.remote.capabilities(): | |
186 | kwargs[b'known'] = [ |
|
190 | kwargs[b'known'] = [ | |
187 |
|
|
191 | hex(ctx.node()) | |
188 | for ctx in repo.set(b'::%ln', pullop.common) |
|
192 | for ctx in repo.set(b'::%ln', pullop.common) | |
189 |
if ctx.node() != |
|
193 | if ctx.node() != nullid | |
190 | ] |
|
194 | ] | |
191 | if not kwargs[b'known']: |
|
195 | if not kwargs[b'known']: | |
192 | # Mercurial serializes an empty list as '' and deserializes it as |
|
196 | # Mercurial serializes an empty list as '' and deserializes it as | |
@@ -239,10 +243,10 b' def _narrow(' | |||||
239 | maxnodes = 10 |
|
243 | maxnodes = 10 | |
240 | if ui.verbose or len(visibletostrip) <= maxnodes: |
|
244 | if ui.verbose or len(visibletostrip) <= maxnodes: | |
241 | for n in visibletostrip: |
|
245 | for n in visibletostrip: | |
242 |
ui.status(b'%s\n' % |
|
246 | ui.status(b'%s\n' % short(n)) | |
243 | else: |
|
247 | else: | |
244 | for n in visibletostrip[:maxnodes]: |
|
248 | for n in visibletostrip[:maxnodes]: | |
245 |
ui.status(b'%s\n' % |
|
249 | ui.status(b'%s\n' % short(n)) | |
246 | ui.status( |
|
250 | ui.status( | |
247 | _(b'...and %d more, use --verbose to list all\n') |
|
251 | _(b'...and %d more, use --verbose to list all\n') | |
248 | % (len(visibletostrip) - maxnodes) |
|
252 | % (len(visibletostrip) - maxnodes) | |
@@ -362,7 +366,7 b' def _widen(' | |||||
362 | ds = repo.dirstate |
|
366 | ds = repo.dirstate | |
363 | p1, p2 = ds.p1(), ds.p2() |
|
367 | p1, p2 = ds.p1(), ds.p2() | |
364 | with ds.parentchange(): |
|
368 | with ds.parentchange(): | |
365 |
ds.setparents( |
|
369 | ds.setparents(nullid, nullid) | |
366 | if isoldellipses: |
|
370 | if isoldellipses: | |
367 | with wrappedextraprepare: |
|
371 | with wrappedextraprepare: | |
368 | exchange.pull(repo, remote, heads=common) |
|
372 | exchange.pull(repo, remote, heads=common) | |
@@ -372,7 +376,7 b' def _widen(' | |||||
372 | known = [ |
|
376 | known = [ | |
373 | ctx.node() |
|
377 | ctx.node() | |
374 | for ctx in repo.set(b'::%ln', common) |
|
378 | for ctx in repo.set(b'::%ln', common) | |
375 |
if ctx.node() != |
|
379 | if ctx.node() != nullid | |
376 | ] |
|
380 | ] | |
377 | with remote.commandexecutor() as e: |
|
381 | with remote.commandexecutor() as e: | |
378 | bundle = e.callcommand( |
|
382 | bundle = e.callcommand( |
@@ -83,6 +83,7 b' import socket' | |||||
83 |
|
83 | |||
84 | from mercurial.i18n import _ |
|
84 | from mercurial.i18n import _ | |
85 | from mercurial.pycompat import open |
|
85 | from mercurial.pycompat import open | |
|
86 | from mercurial.node import bin | |||
86 | from mercurial import ( |
|
87 | from mercurial import ( | |
87 | cmdutil, |
|
88 | cmdutil, | |
88 | commands, |
|
89 | commands, | |
@@ -91,7 +92,6 b' from mercurial import (' | |||||
91 | formatter, |
|
92 | formatter, | |
92 | hg, |
|
93 | hg, | |
93 | mail, |
|
94 | mail, | |
94 | node as nodemod, |
|
|||
95 | patch, |
|
95 | patch, | |
96 | pycompat, |
|
96 | pycompat, | |
97 | registrar, |
|
97 | registrar, | |
@@ -306,7 +306,7 b' def makepatch(' | |||||
306 | p = mail.mimetextpatch( |
|
306 | p = mail.mimetextpatch( | |
307 | b'\n'.join(patchlines), 'x-patch', opts.get(b'test') |
|
307 | b'\n'.join(patchlines), 'x-patch', opts.get(b'test') | |
308 | ) |
|
308 | ) | |
309 |
binnode = |
|
309 | binnode = bin(node) | |
310 | # if node is mq patch, it will have the patch file's name as a tag |
|
310 | # if node is mq patch, it will have the patch file's name as a tag | |
311 | if not patchname: |
|
311 | if not patchname: | |
312 | patchtags = [ |
|
312 | patchtags = [ |
@@ -23,6 +23,7 b' from mercurial.i18n import _' | |||||
23 | from mercurial.node import ( |
|
23 | from mercurial.node import ( | |
24 | nullrev, |
|
24 | nullrev, | |
25 | short, |
|
25 | short, | |
|
26 | wdirrev, | |||
26 | ) |
|
27 | ) | |
27 | from mercurial.pycompat import open |
|
28 | from mercurial.pycompat import open | |
28 | from mercurial import ( |
|
29 | from mercurial import ( | |
@@ -37,7 +38,6 b' from mercurial import (' | |||||
37 | merge as mergemod, |
|
38 | merge as mergemod, | |
38 | mergestate as mergestatemod, |
|
39 | mergestate as mergestatemod, | |
39 | mergeutil, |
|
40 | mergeutil, | |
40 | node as nodemod, |
|
|||
41 | obsolete, |
|
41 | obsolete, | |
42 | obsutil, |
|
42 | obsutil, | |
43 | patch, |
|
43 | patch, | |
@@ -1374,7 +1374,7 b' def _definedestmap(ui, repo, inmemory, d' | |||||
1374 | ) |
|
1374 | ) | |
1375 | return None |
|
1375 | return None | |
1376 |
|
1376 | |||
1377 |
if |
|
1377 | if wdirrev in rebaseset: | |
1378 | raise error.Abort(_(b'cannot rebase the working copy')) |
|
1378 | raise error.Abort(_(b'cannot rebase the working copy')) | |
1379 | rebasingwcp = repo[b'.'].rev() in rebaseset |
|
1379 | rebasingwcp = repo[b'.'].rev() in rebaseset | |
1380 | ui.log( |
|
1380 | ui.log( |
@@ -19,12 +19,12 b' import re' | |||||
19 |
|
19 | |||
20 | from mercurial.i18n import _ |
|
20 | from mercurial.i18n import _ | |
21 | from mercurial.pycompat import open |
|
21 | from mercurial.pycompat import open | |
|
22 | from mercurial.node import hex | |||
22 | from mercurial import ( |
|
23 | from mercurial import ( | |
23 | cmdutil, |
|
24 | cmdutil, | |
24 | config, |
|
25 | config, | |
25 | error, |
|
26 | error, | |
26 | minirst, |
|
27 | minirst, | |
27 | node, |
|
|||
28 | pycompat, |
|
28 | pycompat, | |
29 | registrar, |
|
29 | registrar, | |
30 | scmutil, |
|
30 | scmutil, | |
@@ -381,7 +381,7 b' def parsenotesfromrevisions(repo, direct' | |||||
381 | if not paragraphs: |
|
381 | if not paragraphs: | |
382 | repo.ui.warn( |
|
382 | repo.ui.warn( | |
383 | _(b"error parsing releasenotes for revision: '%s'\n") |
|
383 | _(b"error parsing releasenotes for revision: '%s'\n") | |
384 |
% |
|
384 | % hex(ctx.node()) | |
385 | ) |
|
385 | ) | |
386 | if title: |
|
386 | if title: | |
387 | notes.addtitleditem(directive, title, paragraphs) |
|
387 | notes.addtitleditem(directive, title, paragraphs) |
@@ -130,7 +130,10 b' import os' | |||||
130 | import time |
|
130 | import time | |
131 | import traceback |
|
131 | import traceback | |
132 |
|
132 | |||
133 |
from mercurial.node import |
|
133 | from mercurial.node import ( | |
|
134 | hex, | |||
|
135 | wdirrev, | |||
|
136 | ) | |||
134 | from mercurial.i18n import _ |
|
137 | from mercurial.i18n import _ | |
135 | from mercurial.pycompat import open |
|
138 | from mercurial.pycompat import open | |
136 | from mercurial import ( |
|
139 | from mercurial import ( | |
@@ -150,7 +153,6 b' from mercurial import (' | |||||
150 | match as matchmod, |
|
153 | match as matchmod, | |
151 | merge, |
|
154 | merge, | |
152 | mergestate as mergestatemod, |
|
155 | mergestate as mergestatemod, | |
153 | node as nodemod, |
|
|||
154 | patch, |
|
156 | patch, | |
155 | pycompat, |
|
157 | pycompat, | |
156 | registrar, |
|
158 | registrar, | |
@@ -1091,7 +1093,7 b' def _fileprefetchhook(repo, revmatches):' | |||||
1091 | if isenabled(repo): |
|
1093 | if isenabled(repo): | |
1092 | allfiles = [] |
|
1094 | allfiles = [] | |
1093 | for rev, match in revmatches: |
|
1095 | for rev, match in revmatches: | |
1094 |
if rev == |
|
1096 | if rev == wdirrev or rev is None: | |
1095 | continue |
|
1097 | continue | |
1096 | ctx = repo[rev] |
|
1098 | ctx = repo[rev] | |
1097 | mf = ctx.manifest() |
|
1099 | mf = ctx.manifest() |
@@ -12,8 +12,8 b' from mercurial.pycompat import (' | |||||
12 | getattr, |
|
12 | getattr, | |
13 | open, |
|
13 | open, | |
14 | ) |
|
14 | ) | |
|
15 | from mercurial.node import hex | |||
15 | from mercurial import ( |
|
16 | from mercurial import ( | |
16 | node as nodemod, |
|
|||
17 | policy, |
|
17 | policy, | |
18 | pycompat, |
|
18 | pycompat, | |
19 | util, |
|
19 | util, | |
@@ -429,7 +429,7 b' class mutablebasepack(versionmixin):' | |||||
429 | return |
|
429 | return | |
430 |
|
430 | |||
431 | try: |
|
431 | try: | |
432 |
sha = |
|
432 | sha = hex(self.sha.digest()) | |
433 | self.packfp.close() |
|
433 | self.packfp.close() | |
434 | self.writeindex() |
|
434 | self.writeindex() | |
435 |
|
435 |
@@ -9,14 +9,18 b' from __future__ import absolute_import' | |||||
9 | import os |
|
9 | import os | |
10 | import zlib |
|
10 | import zlib | |
11 |
|
11 | |||
12 |
from mercurial.node import |
|
12 | from mercurial.node import ( | |
|
13 | bin, | |||
|
14 | hex, | |||
|
15 | nullid, | |||
|
16 | short, | |||
|
17 | ) | |||
13 | from mercurial.i18n import _ |
|
18 | from mercurial.i18n import _ | |
14 | from mercurial.pycompat import open |
|
19 | from mercurial.pycompat import open | |
15 | from mercurial import ( |
|
20 | from mercurial import ( | |
16 | error, |
|
21 | error, | |
17 | filelog, |
|
22 | filelog, | |
18 | lock as lockmod, |
|
23 | lock as lockmod, | |
19 | node as nodemod, |
|
|||
20 | pycompat, |
|
24 | pycompat, | |
21 | revlog, |
|
25 | revlog, | |
22 | ) |
|
26 | ) | |
@@ -61,7 +65,7 b' def debugremotefilelog(ui, path, **opts)' | |||||
61 |
|
65 | |||
62 | def buildtemprevlog(repo, file): |
|
66 | def buildtemprevlog(repo, file): | |
63 | # get filename key |
|
67 | # get filename key | |
64 |
filekey = |
|
68 | filekey = hex(hashutil.sha1(file).digest()) | |
65 | filedir = os.path.join(repo.path, b'store/data', filekey) |
|
69 | filedir = os.path.join(repo.path, b'store/data', filekey) | |
66 |
|
70 | |||
67 | # sort all entries based on linkrev |
|
71 | # sort all entries based on linkrev | |
@@ -421,7 +425,7 b' def dumpdeltachain(ui, deltachain, **opt' | |||||
421 | % ( |
|
425 | % ( | |
422 | hashformatter(node), |
|
426 | hashformatter(node), | |
423 | hashformatter(deltabasenode), |
|
427 | hashformatter(deltabasenode), | |
424 |
|
|
428 | hex(hashutil.sha1(delta).digest()), | |
425 | len(delta), |
|
429 | len(delta), | |
426 | ) |
|
430 | ) | |
427 | ) |
|
431 | ) |
@@ -17,7 +17,6 b' from mercurial.i18n import _' | |||||
17 | from mercurial.node import bin, hex, nullid |
|
17 | from mercurial.node import bin, hex, nullid | |
18 | from mercurial import ( |
|
18 | from mercurial import ( | |
19 | error, |
|
19 | error, | |
20 | node, |
|
|||
21 | pycompat, |
|
20 | pycompat, | |
22 | revlog, |
|
21 | revlog, | |
23 | sshpeer, |
|
22 | sshpeer, | |
@@ -47,12 +46,12 b' fetchmisses = 0' | |||||
47 |
|
46 | |||
48 |
|
47 | |||
49 | def getcachekey(reponame, file, id): |
|
48 | def getcachekey(reponame, file, id): | |
50 |
pathhash = |
|
49 | pathhash = hex(hashutil.sha1(file).digest()) | |
51 | return os.path.join(reponame, pathhash[:2], pathhash[2:], id) |
|
50 | return os.path.join(reponame, pathhash[:2], pathhash[2:], id) | |
52 |
|
51 | |||
53 |
|
52 | |||
54 | def getlocalkey(file, id): |
|
53 | def getlocalkey(file, id): | |
55 |
pathhash = |
|
54 | pathhash = hex(hashutil.sha1(file).digest()) | |
56 | return os.path.join(pathhash, id) |
|
55 | return os.path.join(pathhash, id) | |
57 |
|
56 | |||
58 |
|
57 |
@@ -15,9 +15,9 b' import tempfile' | |||||
15 |
|
15 | |||
16 | from mercurial.i18n import _ |
|
16 | from mercurial.i18n import _ | |
17 | from mercurial.pycompat import open |
|
17 | from mercurial.pycompat import open | |
|
18 | from mercurial.node import hex | |||
18 | from mercurial import ( |
|
19 | from mercurial import ( | |
19 | error, |
|
20 | error, | |
20 | node, |
|
|||
21 | pycompat, |
|
21 | pycompat, | |
22 | revlog, |
|
22 | revlog, | |
23 | util, |
|
23 | util, | |
@@ -39,12 +39,12 b' def isenabled(repo):' | |||||
39 |
|
39 | |||
40 |
|
40 | |||
41 | def getcachekey(reponame, file, id): |
|
41 | def getcachekey(reponame, file, id): | |
42 |
pathhash = |
|
42 | pathhash = hex(hashutil.sha1(file).digest()) | |
43 | return os.path.join(reponame, pathhash[:2], pathhash[2:], id) |
|
43 | return os.path.join(reponame, pathhash[:2], pathhash[2:], id) | |
44 |
|
44 | |||
45 |
|
45 | |||
46 | def getlocalkey(file, id): |
|
46 | def getlocalkey(file, id): | |
47 |
pathhash = |
|
47 | pathhash = hex(hashutil.sha1(file).digest()) | |
48 | return os.path.join(pathhash, id) |
|
48 | return os.path.join(pathhash, id) | |
49 |
|
49 | |||
50 |
|
50 |
@@ -19,6 +19,12 b' import os' | |||||
19 |
|
19 | |||
20 | from mercurial.i18n import _ |
|
20 | from mercurial.i18n import _ | |
21 | from mercurial.pycompat import open |
|
21 | from mercurial.pycompat import open | |
|
22 | from mercurial.node import ( | |||
|
23 | bin, | |||
|
24 | hex, | |||
|
25 | nullid, | |||
|
26 | short, | |||
|
27 | ) | |||
22 | from mercurial import ( |
|
28 | from mercurial import ( | |
23 | bundlerepo, |
|
29 | bundlerepo, | |
24 | cmdutil, |
|
30 | cmdutil, | |
@@ -28,11 +34,9 b' from mercurial import (' | |||||
28 | logcmdutil, |
|
34 | logcmdutil, | |
29 | match, |
|
35 | match, | |
30 | merge, |
|
36 | merge, | |
31 | node as nodemod, |
|
|||
32 | patch, |
|
37 | patch, | |
33 | pycompat, |
|
38 | pycompat, | |
34 | registrar, |
|
39 | registrar, | |
35 | revlog, |
|
|||
36 | revset, |
|
40 | revset, | |
37 | scmutil, |
|
41 | scmutil, | |
38 | smartset, |
|
42 | smartset, | |
@@ -95,7 +99,7 b' class transplants(object):' | |||||
95 | abspath = os.path.join(self.path, self.transplantfile) |
|
99 | abspath = os.path.join(self.path, self.transplantfile) | |
96 | if self.transplantfile and os.path.exists(abspath): |
|
100 | if self.transplantfile and os.path.exists(abspath): | |
97 | for line in self.opener.read(self.transplantfile).splitlines(): |
|
101 | for line in self.opener.read(self.transplantfile).splitlines(): | |
98 |
lnode, rnode = map( |
|
102 | lnode, rnode = map(bin, line.split(b':')) | |
99 | list = self.transplants.setdefault(rnode, []) |
|
103 | list = self.transplants.setdefault(rnode, []) | |
100 | list.append(transplantentry(lnode, rnode)) |
|
104 | list.append(transplantentry(lnode, rnode)) | |
101 |
|
105 | |||
@@ -106,7 +110,7 b' class transplants(object):' | |||||
106 | fp = self.opener(self.transplantfile, b'w') |
|
110 | fp = self.opener(self.transplantfile, b'w') | |
107 | for list in pycompat.itervalues(self.transplants): |
|
111 | for list in pycompat.itervalues(self.transplants): | |
108 | for t in list: |
|
112 | for t in list: | |
109 |
l, r = map( |
|
113 | l, r = map(hex, (t.lnode, t.rnode)) | |
110 | fp.write(l + b':' + r + b'\n') |
|
114 | fp.write(l + b':' + r + b'\n') | |
111 | fp.close() |
|
115 | fp.close() | |
112 | self.dirty = False |
|
116 | self.dirty = False | |
@@ -183,7 +187,7 b' class transplanter(object):' | |||||
183 | tr = repo.transaction(b'transplant') |
|
187 | tr = repo.transaction(b'transplant') | |
184 | for rev in revs: |
|
188 | for rev in revs: | |
185 | node = revmap[rev] |
|
189 | node = revmap[rev] | |
186 |
revstr = b'%d:%s' % (rev, |
|
190 | revstr = b'%d:%s' % (rev, short(node)) | |
187 |
|
191 | |||
188 | if self.applied(repo, node, p1): |
|
192 | if self.applied(repo, node, p1): | |
189 | self.ui.warn( |
|
193 | self.ui.warn( | |
@@ -216,11 +220,11 b' class transplanter(object):' | |||||
216 | exchange.pull(repo, source.peer(), heads=[node]) |
|
220 | exchange.pull(repo, source.peer(), heads=[node]) | |
217 |
|
221 | |||
218 | skipmerge = False |
|
222 | skipmerge = False | |
219 |
if parents[1] != |
|
223 | if parents[1] != nullid: | |
220 | if not opts.get(b'parent'): |
|
224 | if not opts.get(b'parent'): | |
221 | self.ui.note( |
|
225 | self.ui.note( | |
222 | _(b'skipping merge changeset %d:%s\n') |
|
226 | _(b'skipping merge changeset %d:%s\n') | |
223 |
% (rev, |
|
227 | % (rev, short(node)) | |
224 | ) |
|
228 | ) | |
225 | skipmerge = True |
|
229 | skipmerge = True | |
226 | else: |
|
230 | else: | |
@@ -228,7 +232,7 b' class transplanter(object):' | |||||
228 | if parent not in parents: |
|
232 | if parent not in parents: | |
229 | raise error.Abort( |
|
233 | raise error.Abort( | |
230 | _(b'%s is not a parent of %s') |
|
234 | _(b'%s is not a parent of %s') | |
231 |
% ( |
|
235 | % (short(parent), short(node)) | |
232 | ) |
|
236 | ) | |
233 | else: |
|
237 | else: | |
234 | parent = parents[0] |
|
238 | parent = parents[0] | |
@@ -263,13 +267,12 b' class transplanter(object):' | |||||
263 | raise |
|
267 | raise | |
264 | if n and domerge: |
|
268 | if n and domerge: | |
265 | self.ui.status( |
|
269 | self.ui.status( | |
266 | _(b'%s merged at %s\n') |
|
270 | _(b'%s merged at %s\n') % (revstr, short(n)) | |
267 | % (revstr, nodemod.short(n)) |
|
|||
268 | ) |
|
271 | ) | |
269 | elif n: |
|
272 | elif n: | |
270 | self.ui.status( |
|
273 | self.ui.status( | |
271 | _(b'%s transplanted to %s\n') |
|
274 | _(b'%s transplanted to %s\n') | |
272 |
% ( |
|
275 | % (short(node), short(n)) | |
273 | ) |
|
276 | ) | |
274 | finally: |
|
277 | finally: | |
275 | if patchfile: |
|
278 | if patchfile: | |
@@ -309,7 +312,7 b' class transplanter(object):' | |||||
309 | ), |
|
312 | ), | |
310 | environ={ |
|
313 | environ={ | |
311 | b'HGUSER': changelog[1], |
|
314 | b'HGUSER': changelog[1], | |
312 |
b'HGREVISION': |
|
315 | b'HGREVISION': hex(node), | |
313 | }, |
|
316 | }, | |
314 | onerr=error.Abort, |
|
317 | onerr=error.Abort, | |
315 | errprefix=_(b'filter failed'), |
|
318 | errprefix=_(b'filter failed'), | |
@@ -333,9 +336,9 b' class transplanter(object):' | |||||
333 |
|
336 | |||
334 | if log: |
|
337 | if log: | |
335 | # we don't translate messages inserted into commits |
|
338 | # we don't translate messages inserted into commits | |
336 |
message += b'\n(transplanted from %s)' % |
|
339 | message += b'\n(transplanted from %s)' % hex(node) | |
337 |
|
340 | |||
338 |
self.ui.status(_(b'applying %s\n') % |
|
341 | self.ui.status(_(b'applying %s\n') % short(node)) | |
339 | self.ui.note(b'%s %s\n%s\n' % (user, date, message)) |
|
342 | self.ui.note(b'%s %s\n%s\n' % (user, date, message)) | |
340 |
|
343 | |||
341 | if not patchfile and not merge: |
|
344 | if not patchfile and not merge: | |
@@ -377,9 +380,7 b' class transplanter(object):' | |||||
377 | editor=self.getcommiteditor(), |
|
380 | editor=self.getcommiteditor(), | |
378 | ) |
|
381 | ) | |
379 | if not n: |
|
382 | if not n: | |
380 | self.ui.warn( |
|
383 | self.ui.warn(_(b'skipping emptied changeset %s\n') % short(node)) | |
381 | _(b'skipping emptied changeset %s\n') % nodemod.short(node) |
|
|||
382 | ) |
|
|||
383 | return None |
|
384 | return None | |
384 | if not merge: |
|
385 | if not merge: | |
385 | self.transplants.set(n, node) |
|
386 | self.transplants.set(n, node) | |
@@ -395,13 +396,11 b' class transplanter(object):' | |||||
395 | n, node = self.recover(repo, source, opts) |
|
396 | n, node = self.recover(repo, source, opts) | |
396 | if n: |
|
397 | if n: | |
397 | self.ui.status( |
|
398 | self.ui.status( | |
398 | _(b'%s transplanted as %s\n') |
|
399 | _(b'%s transplanted as %s\n') % (short(node), short(n)) | |
399 | % (nodemod.short(node), nodemod.short(n)) |
|
|||
400 | ) |
|
400 | ) | |
401 | else: |
|
401 | else: | |
402 | self.ui.status( |
|
402 | self.ui.status( | |
403 | _(b'%s skipped due to empty diff\n') |
|
403 | _(b'%s skipped due to empty diff\n') % (short(node),) | |
404 | % (nodemod.short(node),) |
|
|||
405 | ) |
|
404 | ) | |
406 | seriespath = os.path.join(self.path, b'series') |
|
405 | seriespath = os.path.join(self.path, b'series') | |
407 | if not os.path.exists(seriespath): |
|
406 | if not os.path.exists(seriespath): | |
@@ -430,7 +429,7 b' class transplanter(object):' | |||||
430 | if parent not in parents: |
|
429 | if parent not in parents: | |
431 | raise error.Abort( |
|
430 | raise error.Abort( | |
432 | _(b'%s is not a parent of %s') |
|
431 | _(b'%s is not a parent of %s') | |
433 |
% ( |
|
432 | % (short(parent), short(node)) | |
434 | ) |
|
433 | ) | |
435 | else: |
|
434 | else: | |
436 | merge = True |
|
435 | merge = True | |
@@ -441,7 +440,7 b' class transplanter(object):' | |||||
441 | if p1 != parent: |
|
440 | if p1 != parent: | |
442 | raise error.Abort( |
|
441 | raise error.Abort( | |
443 | _(b'working directory not at transplant parent %s') |
|
442 | _(b'working directory not at transplant parent %s') | |
444 |
% |
|
443 | % hex(parent) | |
445 | ) |
|
444 | ) | |
446 | if merge: |
|
445 | if merge: | |
447 | repo.setparents(p1, parents[1]) |
|
446 | repo.setparents(p1, parents[1]) | |
@@ -494,7 +493,7 b' class transplanter(object):' | |||||
494 | if line.startswith(b'# Merges'): |
|
493 | if line.startswith(b'# Merges'): | |
495 | cur = merges |
|
494 | cur = merges | |
496 | continue |
|
495 | continue | |
497 |
cur.append( |
|
496 | cur.append(bin(line)) | |
498 |
|
497 | |||
499 | return (nodes, merges) |
|
498 | return (nodes, merges) | |
500 |
|
499 | |||
@@ -506,17 +505,17 b' class transplanter(object):' | |||||
506 | os.mkdir(self.path) |
|
505 | os.mkdir(self.path) | |
507 | series = self.opener(b'series', b'w') |
|
506 | series = self.opener(b'series', b'w') | |
508 | for rev in sorted(revmap): |
|
507 | for rev in sorted(revmap): | |
509 |
series.write( |
|
508 | series.write(hex(revmap[rev]) + b'\n') | |
510 | if merges: |
|
509 | if merges: | |
511 | series.write(b'# Merges\n') |
|
510 | series.write(b'# Merges\n') | |
512 | for m in merges: |
|
511 | for m in merges: | |
513 |
series.write( |
|
512 | series.write(hex(m) + b'\n') | |
514 | series.close() |
|
513 | series.close() | |
515 |
|
514 | |||
516 | def parselog(self, fp): |
|
515 | def parselog(self, fp): | |
517 | parents = [] |
|
516 | parents = [] | |
518 | message = [] |
|
517 | message = [] | |
519 |
node = |
|
518 | node = nullid | |
520 | inmsg = False |
|
519 | inmsg = False | |
521 | user = None |
|
520 | user = None | |
522 | date = None |
|
521 | date = None | |
@@ -528,9 +527,9 b' class transplanter(object):' | |||||
528 | elif line.startswith(b'# Date '): |
|
527 | elif line.startswith(b'# Date '): | |
529 | date = line[7:] |
|
528 | date = line[7:] | |
530 | elif line.startswith(b'# Node ID '): |
|
529 | elif line.startswith(b'# Node ID '): | |
531 |
node = |
|
530 | node = bin(line[10:]) | |
532 | elif line.startswith(b'# Parent '): |
|
531 | elif line.startswith(b'# Parent '): | |
533 |
parents.append( |
|
532 | parents.append(bin(line[9:])) | |
534 | elif not line.startswith(b'# '): |
|
533 | elif not line.startswith(b'# '): | |
535 | inmsg = True |
|
534 | inmsg = True | |
536 | message.append(line) |
|
535 | message.append(line) | |
@@ -548,10 +547,10 b' class transplanter(object):' | |||||
548 | fp = self.opener(b'journal', b'w') |
|
547 | fp = self.opener(b'journal', b'w') | |
549 | fp.write(b'# User %s\n' % user) |
|
548 | fp.write(b'# User %s\n' % user) | |
550 | fp.write(b'# Date %s\n' % date) |
|
549 | fp.write(b'# Date %s\n' % date) | |
551 |
fp.write(b'# Node ID %s\n' % |
|
550 | fp.write(b'# Node ID %s\n' % hex(p2)) | |
552 |
fp.write(b'# Parent ' + |
|
551 | fp.write(b'# Parent ' + hex(p1) + b'\n') | |
553 | if merge: |
|
552 | if merge: | |
554 |
fp.write(b'# Parent ' + |
|
553 | fp.write(b'# Parent ' + hex(p2) + b'\n') | |
555 | fp.write(message.rstrip() + b'\n') |
|
554 | fp.write(message.rstrip() + b'\n') | |
556 | fp.close() |
|
555 | fp.close() | |
557 |
|
556 | |||
@@ -568,7 +567,7 b' class transplanter(object):' | |||||
568 | def matchfn(node): |
|
567 | def matchfn(node): | |
569 | if self.applied(repo, node, root): |
|
568 | if self.applied(repo, node, root): | |
570 | return False |
|
569 | return False | |
571 |
if source.changelog.parents(node)[1] != |
|
570 | if source.changelog.parents(node)[1] != nullid: | |
572 | return False |
|
571 | return False | |
573 | extra = source.changelog.read(node)[5] |
|
572 | extra = source.changelog.read(node)[5] | |
574 | cnode = extra.get(b'transplant_source') |
|
573 | cnode = extra.get(b'transplant_source') | |
@@ -804,7 +803,7 b' def _dotransplant(ui, repo, *revs, **opt' | |||||
804 | tp = transplanter(ui, repo, opts) |
|
803 | tp = transplanter(ui, repo, opts) | |
805 |
|
804 | |||
806 | p1 = repo.dirstate.p1() |
|
805 | p1 = repo.dirstate.p1() | |
807 |
if len(repo) > 0 and p1 == |
|
806 | if len(repo) > 0 and p1 == nullid: | |
808 | raise error.Abort(_(b'no revision checked out')) |
|
807 | raise error.Abort(_(b'no revision checked out')) | |
809 | if opts.get(b'continue'): |
|
808 | if opts.get(b'continue'): | |
810 | if not tp.canresume(): |
|
809 | if not tp.canresume(): | |
@@ -909,7 +908,7 b' def kwtransplanted(context, mapping):' | |||||
909 | changeset if any.""" |
|
908 | changeset if any.""" | |
910 | ctx = context.resource(mapping, b'ctx') |
|
909 | ctx = context.resource(mapping, b'ctx') | |
911 | n = ctx.extra().get(b'transplant_source') |
|
910 | n = ctx.extra().get(b'transplant_source') | |
912 |
return n and |
|
911 | return n and hex(n) or b'' | |
913 |
|
912 | |||
914 |
|
913 | |||
915 | def extsetup(ui): |
|
914 | def extsetup(ui): |
@@ -20,6 +20,7 b' added and removed in the working directo' | |||||
20 | from __future__ import absolute_import |
|
20 | from __future__ import absolute_import | |
21 |
|
21 | |||
22 | from mercurial.i18n import _ |
|
22 | from mercurial.i18n import _ | |
|
23 | from mercurial.node import nullid | |||
23 |
|
24 | |||
24 | from mercurial import ( |
|
25 | from mercurial import ( | |
25 | cmdutil, |
|
26 | cmdutil, | |
@@ -27,7 +28,6 b' from mercurial import (' | |||||
27 | context, |
|
28 | context, | |
28 | copies as copiesmod, |
|
29 | copies as copiesmod, | |
29 | error, |
|
30 | error, | |
30 | node, |
|
|||
31 | obsutil, |
|
31 | obsutil, | |
32 | pathutil, |
|
32 | pathutil, | |
33 | pycompat, |
|
33 | pycompat, | |
@@ -113,7 +113,7 b' def _commitfiltered(' | |||||
113 |
|
113 | |||
114 | new = context.memctx( |
|
114 | new = context.memctx( | |
115 | repo, |
|
115 | repo, | |
116 |
parents=[base.node(), |
|
116 | parents=[base.node(), nullid], | |
117 | text=message, |
|
117 | text=message, | |
118 | files=files, |
|
118 | files=files, | |
119 | filectxfn=filectxfn, |
|
119 | filectxfn=filectxfn, |
@@ -156,12 +156,16 b' import struct' | |||||
156 | import sys |
|
156 | import sys | |
157 |
|
157 | |||
158 | from .i18n import _ |
|
158 | from .i18n import _ | |
|
159 | from .node import ( | |||
|
160 | hex, | |||
|
161 | nullid, | |||
|
162 | short, | |||
|
163 | ) | |||
159 | from . import ( |
|
164 | from . import ( | |
160 | bookmarks, |
|
165 | bookmarks, | |
161 | changegroup, |
|
166 | changegroup, | |
162 | encoding, |
|
167 | encoding, | |
163 | error, |
|
168 | error, | |
164 | node as nodemod, |
|
|||
165 | obsolete, |
|
169 | obsolete, | |
166 | phases, |
|
170 | phases, | |
167 | pushkey, |
|
171 | pushkey, | |
@@ -2131,14 +2135,14 b' def handlecheckbookmarks(op, inpart):' | |||||
2131 | currentnode = op.repo._bookmarks.get(book) |
|
2135 | currentnode = op.repo._bookmarks.get(book) | |
2132 | if currentnode != node: |
|
2136 | if currentnode != node: | |
2133 | if node is None: |
|
2137 | if node is None: | |
2134 |
finalmsg = msgexist % (book, |
|
2138 | finalmsg = msgexist % (book, short(currentnode)) | |
2135 | elif currentnode is None: |
|
2139 | elif currentnode is None: | |
2136 |
finalmsg = msgmissing % (book, |
|
2140 | finalmsg = msgmissing % (book, short(node)) | |
2137 | else: |
|
2141 | else: | |
2138 | finalmsg = msgstandard % ( |
|
2142 | finalmsg = msgstandard % ( | |
2139 | book, |
|
2143 | book, | |
2140 |
|
|
2144 | short(node), | |
2141 |
|
|
2145 | short(currentnode), | |
2142 | ) |
|
2146 | ) | |
2143 | raise error.PushRaced(finalmsg) |
|
2147 | raise error.PushRaced(finalmsg) | |
2144 |
|
2148 | |||
@@ -2215,7 +2219,7 b' def handlecheckphases(op, inpart):' | |||||
2215 | actualphase = phasecache.phase(unfi, cl.rev(n)) |
|
2219 | actualphase = phasecache.phase(unfi, cl.rev(n)) | |
2216 | if actualphase != expectedphase: |
|
2220 | if actualphase != expectedphase: | |
2217 | finalmsg = msg % ( |
|
2221 | finalmsg = msg % ( | |
2218 |
|
|
2222 | short(n), | |
2219 | phases.phasenames[actualphase], |
|
2223 | phases.phasenames[actualphase], | |
2220 | phases.phasenames[expectedphase], |
|
2224 | phases.phasenames[expectedphase], | |
2221 | ) |
|
2225 | ) | |
@@ -2360,10 +2364,8 b' def handlebookmark(op, inpart):' | |||||
2360 | hookargs[b'pushkeycompat'] = b'1' |
|
2364 | hookargs[b'pushkeycompat'] = b'1' | |
2361 | hookargs[b'namespace'] = b'bookmarks' |
|
2365 | hookargs[b'namespace'] = b'bookmarks' | |
2362 | hookargs[b'key'] = book |
|
2366 | hookargs[b'key'] = book | |
2363 |
hookargs[b'old'] = |
|
2367 | hookargs[b'old'] = hex(bookstore.get(book, b'')) | |
2364 |
hookargs[b'new'] = |
|
2368 | hookargs[b'new'] = hex(node if node is not None else b'') | |
2365 | node if node is not None else b'' |
|
|||
2366 | ) |
|
|||
2367 | allhooks.append(hookargs) |
|
2369 | allhooks.append(hookargs) | |
2368 |
|
2370 | |||
2369 | for hookargs in allhooks: |
|
2371 | for hookargs in allhooks: | |
@@ -2569,7 +2571,7 b' def widen_bundle(' | |||||
2569 | fullnodes=commonnodes, |
|
2571 | fullnodes=commonnodes, | |
2570 | ) |
|
2572 | ) | |
2571 | cgdata = packer.generate( |
|
2573 | cgdata = packer.generate( | |
2572 |
{ |
|
2574 | {nullid}, | |
2573 | list(commonnodes), |
|
2575 | list(commonnodes), | |
2574 | False, |
|
2576 | False, | |
2575 | b'narrow_widen', |
|
2577 | b'narrow_widen', |
@@ -17,7 +17,11 b' import os' | |||||
17 | import shutil |
|
17 | import shutil | |
18 |
|
18 | |||
19 | from .i18n import _ |
|
19 | from .i18n import _ | |
20 |
from .node import |
|
20 | from .node import ( | |
|
21 | hex, | |||
|
22 | nullid, | |||
|
23 | nullrev, | |||
|
24 | ) | |||
21 |
|
25 | |||
22 | from . import ( |
|
26 | from . import ( | |
23 | bundle2, |
|
27 | bundle2, | |
@@ -32,7 +36,6 b' from . import (' | |||||
32 | localrepo, |
|
36 | localrepo, | |
33 | manifest, |
|
37 | manifest, | |
34 | mdiff, |
|
38 | mdiff, | |
35 | node as nodemod, |
|
|||
36 | pathutil, |
|
39 | pathutil, | |
37 | phases, |
|
40 | phases, | |
38 | pycompat, |
|
41 | pycompat, | |
@@ -437,9 +440,9 b' class bundlerepository(object):' | |||||
437 | p2rev = self.changelog.rev(p2) |
|
440 | p2rev = self.changelog.rev(p2) | |
438 | msg = _(b"setting parent to node %s that only exists in the bundle\n") |
|
441 | msg = _(b"setting parent to node %s that only exists in the bundle\n") | |
439 | if self.changelog.repotiprev < p1rev: |
|
442 | if self.changelog.repotiprev < p1rev: | |
440 |
self.ui.warn(msg % |
|
443 | self.ui.warn(msg % hex(p1)) | |
441 | if self.changelog.repotiprev < p2rev: |
|
444 | if self.changelog.repotiprev < p2rev: | |
442 |
self.ui.warn(msg % |
|
445 | self.ui.warn(msg % hex(p2)) | |
443 | return super(bundlerepository, self).setparents(p1, p2) |
|
446 | return super(bundlerepository, self).setparents(p1, p2) | |
444 |
|
447 | |||
445 |
|
448 |
@@ -54,13 +54,13 b' from .pycompat import (' | |||||
54 | getattr, |
|
54 | getattr, | |
55 | setattr, |
|
55 | setattr, | |
56 | ) |
|
56 | ) | |
|
57 | from .node import hex | |||
57 |
|
58 | |||
58 | from . import ( |
|
59 | from . import ( | |
59 | commandserver, |
|
60 | commandserver, | |
60 | encoding, |
|
61 | encoding, | |
61 | error, |
|
62 | error, | |
62 | extensions, |
|
63 | extensions, | |
63 | node, |
|
|||
64 | pycompat, |
|
64 | pycompat, | |
65 | util, |
|
65 | util, | |
66 | ) |
|
66 | ) | |
@@ -74,7 +74,7 b' from .utils import (' | |||||
74 |
|
74 | |||
75 | def _hashlist(items): |
|
75 | def _hashlist(items): | |
76 | """return sha1 hexdigest for a list""" |
|
76 | """return sha1 hexdigest for a list""" | |
77 |
return |
|
77 | return hex(hashutil.sha1(stringutil.pprint(items)).digest()) | |
78 |
|
78 | |||
79 |
|
79 | |||
80 | # sensitive config sections affecting confighash |
|
80 | # sensitive config sections affecting confighash |
@@ -11,11 +11,13 b' import collections' | |||||
11 | import os |
|
11 | import os | |
12 |
|
12 | |||
13 | from .i18n import _ |
|
13 | from .i18n import _ | |
14 |
|
14 | from .node import ( | ||
|
15 | nullid, | |||
|
16 | nullrev, | |||
|
17 | ) | |||
15 |
|
18 | |||
16 | from . import ( |
|
19 | from . import ( | |
17 | match as matchmod, |
|
20 | match as matchmod, | |
18 | node, |
|
|||
19 | pathutil, |
|
21 | pathutil, | |
20 | policy, |
|
22 | policy, | |
21 | pycompat, |
|
23 | pycompat, | |
@@ -147,7 +149,7 b' def _committedforwardcopies(a, b, base, ' | |||||
147 | # optimization, since the ctx.files() for a merge commit is not correct for |
|
149 | # optimization, since the ctx.files() for a merge commit is not correct for | |
148 | # this comparison. |
|
150 | # this comparison. | |
149 | forwardmissingmatch = match |
|
151 | forwardmissingmatch = match | |
150 |
if b.p1() == a and b.p2().node() == |
|
152 | if b.p1() == a and b.p2().node() == nullid: | |
151 | filesmatcher = matchmod.exact(b.files()) |
|
153 | filesmatcher = matchmod.exact(b.files()) | |
152 | forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher) |
|
154 | forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher) | |
153 | missing = _computeforwardmissing(a, b, match=forwardmissingmatch) |
|
155 | missing = _computeforwardmissing(a, b, match=forwardmissingmatch) | |
@@ -233,7 +235,7 b' def _revinfo_getter(repo, match):' | |||||
233 | else: |
|
235 | else: | |
234 | raw = None |
|
236 | raw = None | |
235 | value = (p1, p2, raw) |
|
237 | value = (p1, p2, raw) | |
236 |
if p1 != |
|
238 | if p1 != nullrev and p2 != nullrev: | |
237 | # XXX some case we over cache, IGNORE |
|
239 | # XXX some case we over cache, IGNORE | |
238 | merge_caches[rev] = value |
|
240 | merge_caches[rev] = value | |
239 | return value |
|
241 | return value | |
@@ -250,7 +252,7 b' def _revinfo_getter(repo, match):' | |||||
250 | if flags(rev) & HASCOPIESINFO: |
|
252 | if flags(rev) & HASCOPIESINFO: | |
251 | changes = changelogrevision(rev).changes |
|
253 | changes = changelogrevision(rev).changes | |
252 | value = (p1, p2, changes) |
|
254 | value = (p1, p2, changes) | |
253 |
if p1 != |
|
255 | if p1 != nullrev and p2 != nullrev: | |
254 | # XXX some case we over cache, IGNORE |
|
256 | # XXX some case we over cache, IGNORE | |
255 | merge_caches[rev] = value |
|
257 | merge_caches[rev] = value | |
256 | return value |
|
258 | return value | |
@@ -277,7 +279,7 b' def cached_is_ancestor(is_ancestor):' | |||||
277 |
|
279 | |||
278 |
|
280 | |||
279 | def _changesetforwardcopies(a, b, match): |
|
281 | def _changesetforwardcopies(a, b, match): | |
280 |
if a.rev() in ( |
|
282 | if a.rev() in (nullrev, b.rev()): | |
281 | return {} |
|
283 | return {} | |
282 |
|
284 | |||
283 | repo = a.repo().unfiltered() |
|
285 | repo = a.repo().unfiltered() | |
@@ -290,7 +292,7 b' def _changesetforwardcopies(a, b, match)' | |||||
290 | roots = set() |
|
292 | roots = set() | |
291 | for r in missingrevs: |
|
293 | for r in missingrevs: | |
292 | for p in cl.parentrevs(r): |
|
294 | for p in cl.parentrevs(r): | |
293 |
if p == |
|
295 | if p == nullrev: | |
294 | continue |
|
296 | continue | |
295 | if p not in children: |
|
297 | if p not in children: | |
296 | children[p] = [r] |
|
298 | children[p] = [r] | |
@@ -494,7 +496,7 b' def _revinfo_getter_extra(repo):' | |||||
494 | parents = fctx._filelog.parents(fctx._filenode) |
|
496 | parents = fctx._filelog.parents(fctx._filenode) | |
495 | nb_parents = 0 |
|
497 | nb_parents = 0 | |
496 | for n in parents: |
|
498 | for n in parents: | |
497 |
if n != |
|
499 | if n != nullid: | |
498 | nb_parents += 1 |
|
500 | nb_parents += 1 | |
499 | return nb_parents >= 2 |
|
501 | return nb_parents >= 2 | |
500 |
|
502 | |||
@@ -668,7 +670,7 b' def pathcopies(x, y, match=None):' | |||||
668 | if debug: |
|
670 | if debug: | |
669 | repo.ui.debug(b'debug.copies: search mode: combined\n') |
|
671 | repo.ui.debug(b'debug.copies: search mode: combined\n') | |
670 | base = None |
|
672 | base = None | |
671 |
if a.rev() != |
|
673 | if a.rev() != nullrev: | |
672 | base = x |
|
674 | base = x | |
673 | copies = _chain( |
|
675 | copies = _chain( | |
674 | _backwardrenames(x, a, match=match), |
|
676 | _backwardrenames(x, a, match=match), |
@@ -11,10 +11,10 b' import heapq' | |||||
11 |
|
11 | |||
12 | from .node import nullrev |
|
12 | from .node import nullrev | |
13 | from .thirdparty import attr |
|
13 | from .thirdparty import attr | |
|
14 | from .node import nullrev | |||
14 | from . import ( |
|
15 | from . import ( | |
15 | error, |
|
16 | error, | |
16 | mdiff, |
|
17 | mdiff, | |
17 | node, |
|
|||
18 | patch, |
|
18 | patch, | |
19 | pycompat, |
|
19 | pycompat, | |
20 | scmutil, |
|
20 | scmutil, | |
@@ -77,7 +77,7 b' def _walkrevtree(pfunc, revs, startdepth' | |||||
77 | pdepth = curdepth + 1 |
|
77 | pdepth = curdepth + 1 | |
78 | if foundnew and pdepth < stopdepth: |
|
78 | if foundnew and pdepth < stopdepth: | |
79 | for prev in pfunc(currev): |
|
79 | for prev in pfunc(currev): | |
80 |
if prev != |
|
80 | if prev != nullrev: | |
81 | heapq.heappush(pendingheap, (heapsign * prev, pdepth)) |
|
81 | heapq.heappush(pendingheap, (heapsign * prev, pdepth)) | |
82 |
|
82 | |||
83 |
|
83 | |||
@@ -183,7 +183,6 b' def _genrevdescendants(repo, revs, follo' | |||||
183 |
|
183 | |||
184 | cl = repo.changelog |
|
184 | cl = repo.changelog | |
185 | first = revs.min() |
|
185 | first = revs.min() | |
186 | nullrev = node.nullrev |
|
|||
187 | if first == nullrev: |
|
186 | if first == nullrev: | |
188 | # Are there nodes with a null first parent and a non-null |
|
187 | # Are there nodes with a null first parent and a non-null | |
189 | # second one? Maybe. Do we care? Probably not. |
|
188 | # second one? Maybe. Do we care? Probably not. | |
@@ -206,7 +205,6 b' def _genrevdescendants(repo, revs, follo' | |||||
206 | def _builddescendantsmap(repo, startrev, followfirst): |
|
205 | def _builddescendantsmap(repo, startrev, followfirst): | |
207 | """Build map of 'rev -> child revs', offset from startrev""" |
|
206 | """Build map of 'rev -> child revs', offset from startrev""" | |
208 | cl = repo.changelog |
|
207 | cl = repo.changelog | |
209 | nullrev = node.nullrev |
|
|||
210 | descmap = [[] for _rev in pycompat.xrange(startrev, len(cl))] |
|
208 | descmap = [[] for _rev in pycompat.xrange(startrev, len(cl))] | |
211 | for currev in cl.revs(startrev + 1): |
|
209 | for currev in cl.revs(startrev + 1): | |
212 | p1rev, p2rev = cl.parentrevs(currev) |
|
210 | p1rev, p2rev = cl.parentrevs(currev) | |
@@ -971,7 +969,7 b' def toposort(revs, parentsfunc, firstbra' | |||||
971 | if rev == currentrev: # only display stuff in rev |
|
969 | if rev == currentrev: # only display stuff in rev | |
972 | gr[0].append(rev) |
|
970 | gr[0].append(rev) | |
973 | gr[1].remove(rev) |
|
971 | gr[1].remove(rev) | |
974 |
parents = [p for p in parentsfunc(rev) if p > |
|
972 | parents = [p for p in parentsfunc(rev) if p > nullrev] | |
975 | gr[1].update(parents) |
|
973 | gr[1].update(parents) | |
976 | for p in parents: |
|
974 | for p in parents: | |
977 | if p not in pendingset: |
|
975 | if p not in pendingset: | |
@@ -1030,7 +1028,7 b' def headrevs(revs, parentsfn):' | |||||
1030 | the input set. |
|
1028 | the input set. | |
1031 | """ |
|
1029 | """ | |
1032 | headrevs = set(revs) |
|
1030 | headrevs = set(revs) | |
1033 |
parents = { |
|
1031 | parents = {nullrev} | |
1034 | up = parents.update |
|
1032 | up = parents.update | |
1035 |
|
1033 | |||
1036 | for rev in revs: |
|
1034 | for rev in revs: | |
@@ -1104,7 +1102,7 b' def linearize(revs, parentsfn):' | |||||
1104 | visit.append(-rev - 1) |
|
1102 | visit.append(-rev - 1) | |
1105 |
|
1103 | |||
1106 | for prev in parentsfn(rev): |
|
1104 | for prev in parentsfn(rev): | |
1107 |
if prev == |
|
1105 | if prev == nullrev or prev not in revs or prev in finished: | |
1108 | continue |
|
1106 | continue | |
1109 |
|
1107 | |||
1110 | visit.append(prev) |
|
1108 | visit.append(prev) |
@@ -14,7 +14,12 b' import shutil' | |||||
14 | import stat |
|
14 | import stat | |
15 |
|
15 | |||
16 | from .i18n import _ |
|
16 | from .i18n import _ | |
17 |
from .node import |
|
17 | from .node import ( | |
|
18 | hex, | |||
|
19 | nullhex, | |||
|
20 | nullid, | |||
|
21 | short, | |||
|
22 | ) | |||
18 | from .pycompat import getattr |
|
23 | from .pycompat import getattr | |
19 |
|
24 | |||
20 | from . import ( |
|
25 | from . import ( | |
@@ -35,7 +40,6 b' from . import (' | |||||
35 | merge as mergemod, |
|
40 | merge as mergemod, | |
36 | mergestate as mergestatemod, |
|
41 | mergestate as mergestatemod, | |
37 | narrowspec, |
|
42 | narrowspec, | |
38 | node, |
|
|||
39 | phases, |
|
43 | phases, | |
40 | pycompat, |
|
44 | pycompat, | |
41 | requirements, |
|
45 | requirements, | |
@@ -108,7 +112,7 b' def addbranchrevs(lrepo, other, branches' | |||||
108 | raise error.Abort(_(b"dirstate branch not accessible")) |
|
112 | raise error.Abort(_(b"dirstate branch not accessible")) | |
109 | branch = lrepo.dirstate.branch() |
|
113 | branch = lrepo.dirstate.branch() | |
110 | if branch in branchmap: |
|
114 | if branch in branchmap: | |
111 |
revs.extend( |
|
115 | revs.extend(hex(r) for r in reversed(branchmap[branch])) | |
112 | return True |
|
116 | return True | |
113 | else: |
|
117 | else: | |
114 | return False |
|
118 | return False | |
@@ -762,8 +766,8 b' def clone(' | |||||
762 | }, |
|
766 | }, | |
763 | ).result() |
|
767 | ).result() | |
764 |
|
768 | |||
765 |
if rootnode != |
|
769 | if rootnode != nullid: | |
766 |
sharepath = os.path.join(sharepool, |
|
770 | sharepath = os.path.join(sharepool, hex(rootnode)) | |
767 | else: |
|
771 | else: | |
768 | ui.status( |
|
772 | ui.status( | |
769 | _( |
|
773 | _( | |
@@ -780,7 +784,7 b' def clone(' | |||||
780 | ) |
|
784 | ) | |
781 | elif sharenamemode == b'remote': |
|
785 | elif sharenamemode == b'remote': | |
782 | sharepath = os.path.join( |
|
786 | sharepath = os.path.join( | |
783 |
sharepool, |
|
787 | sharepool, hex(hashutil.sha1(source).digest()) | |
784 | ) |
|
788 | ) | |
785 | else: |
|
789 | else: | |
786 | raise error.Abort( |
|
790 | raise error.Abort( | |
@@ -872,9 +876,7 b' def clone(' | |||||
872 | # we need to re-init the repo after manually copying the data |
|
876 | # we need to re-init the repo after manually copying the data | |
873 | # into it |
|
877 | # into it | |
874 | destpeer = peer(srcrepo, peeropts, dest) |
|
878 | destpeer = peer(srcrepo, peeropts, dest) | |
875 | srcrepo.hook( |
|
879 | srcrepo.hook(b'outgoing', source=b'clone', node=nullhex) | |
876 | b'outgoing', source=b'clone', node=node.hex(node.nullid) |
|
|||
877 | ) |
|
|||
878 | else: |
|
880 | else: | |
879 | try: |
|
881 | try: | |
880 | # only pass ui when no srcrepo |
|
882 | # only pass ui when no srcrepo | |
@@ -1379,7 +1381,7 b' def verify(repo, level=None):' | |||||
1379 | except Exception: |
|
1381 | except Exception: | |
1380 | repo.ui.warn( |
|
1382 | repo.ui.warn( | |
1381 | _(b'.hgsubstate is corrupt in revision %s\n') |
|
1383 | _(b'.hgsubstate is corrupt in revision %s\n') | |
1382 |
% |
|
1384 | % short(ctx.node()) | |
1383 | ) |
|
1385 | ) | |
1384 |
|
1386 | |||
1385 | return ret |
|
1387 | return ret |
@@ -93,8 +93,8 b' import threading' | |||||
93 |
|
93 | |||
94 | from .i18n import _ |
|
94 | from .i18n import _ | |
95 | from .pycompat import getattr |
|
95 | from .pycompat import getattr | |
|
96 | from .node import hex | |||
96 | from . import ( |
|
97 | from . import ( | |
97 | node, |
|
|||
98 | pycompat, |
|
98 | pycompat, | |
99 | urllibcompat, |
|
99 | urllibcompat, | |
100 | util, |
|
100 | util, | |
@@ -723,7 +723,7 b' def continuity(url):' | |||||
723 | foo = fo.read() |
|
723 | foo = fo.read() | |
724 | fo.close() |
|
724 | fo.close() | |
725 | m = md5(foo) |
|
725 | m = md5(foo) | |
726 |
print(format % (b'normal urllib', |
|
726 | print(format % (b'normal urllib', hex(m.digest()))) | |
727 |
|
727 | |||
728 | # now install the keepalive handler and try again |
|
728 | # now install the keepalive handler and try again | |
729 | opener = urlreq.buildopener(HTTPHandler()) |
|
729 | opener = urlreq.buildopener(HTTPHandler()) | |
@@ -733,7 +733,7 b' def continuity(url):' | |||||
733 | foo = fo.read() |
|
733 | foo = fo.read() | |
734 | fo.close() |
|
734 | fo.close() | |
735 | m = md5(foo) |
|
735 | m = md5(foo) | |
736 |
print(format % (b'keepalive read', |
|
736 | print(format % (b'keepalive read', hex(m.digest()))) | |
737 |
|
737 | |||
738 | fo = urlreq.urlopen(url) |
|
738 | fo = urlreq.urlopen(url) | |
739 | foo = b'' |
|
739 | foo = b'' | |
@@ -745,7 +745,7 b' def continuity(url):' | |||||
745 | break |
|
745 | break | |
746 | fo.close() |
|
746 | fo.close() | |
747 | m = md5(foo) |
|
747 | m = md5(foo) | |
748 |
print(format % (b'keepalive readline', |
|
748 | print(format % (b'keepalive readline', hex(m.digest()))) | |
749 |
|
749 | |||
750 |
|
750 | |||
751 | def comp(N, url): |
|
751 | def comp(N, url): |
@@ -11,9 +11,12 b' from __future__ import absolute_import, ' | |||||
11 | import multiprocessing |
|
11 | import multiprocessing | |
12 | import struct |
|
12 | import struct | |
13 |
|
13 | |||
|
14 | from .node import ( | |||
|
15 | nullid, | |||
|
16 | nullrev, | |||
|
17 | ) | |||
14 | from . import ( |
|
18 | from . import ( | |
15 | error, |
|
19 | error, | |
16 | node, |
|
|||
17 | pycompat, |
|
20 | pycompat, | |
18 | util, |
|
21 | util, | |
19 | ) |
|
22 | ) | |
@@ -239,11 +242,11 b' def compute_all_files_changes(ctx):' | |||||
239 | """compute the files changed by a revision""" |
|
242 | """compute the files changed by a revision""" | |
240 | p1 = ctx.p1() |
|
243 | p1 = ctx.p1() | |
241 | p2 = ctx.p2() |
|
244 | p2 = ctx.p2() | |
242 |
if p1.rev() == |
|
245 | if p1.rev() == nullrev and p2.rev() == nullrev: | |
243 | return _process_root(ctx) |
|
246 | return _process_root(ctx) | |
244 |
elif p1.rev() != |
|
247 | elif p1.rev() != nullrev and p2.rev() == nullrev: | |
245 | return _process_linear(p1, ctx) |
|
248 | return _process_linear(p1, ctx) | |
246 |
elif p1.rev() == |
|
249 | elif p1.rev() == nullrev and p2.rev() != nullrev: | |
247 | # In the wild, one can encounter changeset where p1 is null but p2 is not |
|
250 | # In the wild, one can encounter changeset where p1 is null but p2 is not | |
248 | return _process_linear(p1, ctx, parent=2) |
|
251 | return _process_linear(p1, ctx, parent=2) | |
249 | elif p1.rev() == p2.rev(): |
|
252 | elif p1.rev() == p2.rev(): | |
@@ -423,7 +426,7 b' def _process_merge(p1_ctx, p2_ctx, ctx):' | |||||
423 | p1_ctx.node(), p2_ctx.node() |
|
426 | p1_ctx.node(), p2_ctx.node() | |
424 | ) |
|
427 | ) | |
425 | if not cahs: |
|
428 | if not cahs: | |
426 |
cahs = [ |
|
429 | cahs = [nullrev] | |
427 | mas = [ctx.repo()[r].manifest() for r in cahs] |
|
430 | mas = [ctx.repo()[r].manifest() for r in cahs] | |
428 |
|
431 | |||
429 | copy_candidates = [] |
|
432 | copy_candidates = [] | |
@@ -560,7 +563,7 b' def get_removal_filter(ctx, x=None):' | |||||
560 | p2n = p2.node() |
|
563 | p2n = p2.node() | |
561 | cahs = ctx.repo().changelog.commonancestorsheads(p1n, p2n) |
|
564 | cahs = ctx.repo().changelog.commonancestorsheads(p1n, p2n) | |
562 | if not cahs: |
|
565 | if not cahs: | |
563 |
cahs = [ |
|
566 | cahs = [nullrev] | |
564 | return [ctx.repo()[r].manifest() for r in cahs] |
|
567 | return [ctx.repo()[r].manifest() for r in cahs] | |
565 |
|
568 | |||
566 | def deletionfromparent(f): |
|
569 | def deletionfromparent(f): | |
@@ -597,7 +600,7 b' def computechangesetfilesmerged(ctx):' | |||||
597 | if f in ctx: |
|
600 | if f in ctx: | |
598 | fctx = ctx[f] |
|
601 | fctx = ctx[f] | |
599 | parents = fctx._filelog.parents(fctx._filenode) |
|
602 | parents = fctx._filelog.parents(fctx._filenode) | |
600 |
if parents[1] != |
|
603 | if parents[1] != nullid: | |
601 | merged.append(f) |
|
604 | merged.append(f) | |
602 | return merged |
|
605 | return merged | |
603 |
|
606 |
@@ -74,10 +74,14 b' import struct' | |||||
74 |
|
74 | |||
75 | from .i18n import _ |
|
75 | from .i18n import _ | |
76 | from .pycompat import getattr |
|
76 | from .pycompat import getattr | |
|
77 | from .node import ( | |||
|
78 | bin, | |||
|
79 | hex, | |||
|
80 | nullid, | |||
|
81 | ) | |||
77 | from . import ( |
|
82 | from . import ( | |
78 | encoding, |
|
83 | encoding, | |
79 | error, |
|
84 | error, | |
80 | node, |
|
|||
81 | obsutil, |
|
85 | obsutil, | |
82 | phases, |
|
86 | phases, | |
83 | policy, |
|
87 | policy, | |
@@ -235,7 +239,7 b' def _fm0readmarkers(data, off, stop):' | |||||
235 | parents = () |
|
239 | parents = () | |
236 | if parents is not None: |
|
240 | if parents is not None: | |
237 | try: |
|
241 | try: | |
238 |
parents = tuple( |
|
242 | parents = tuple(bin(p) for p in parents) | |
239 | # if parent content is not a nodeid, drop the data |
|
243 | # if parent content is not a nodeid, drop the data | |
240 | for p in parents: |
|
244 | for p in parents: | |
241 | if len(p) != 20: |
|
245 | if len(p) != 20: | |
@@ -262,7 +266,7 b' def _fm0encodeonemarker(marker):' | |||||
262 | # mark that we explicitly recorded no parents |
|
266 | # mark that we explicitly recorded no parents | |
263 | metadata[b'p0'] = b'' |
|
267 | metadata[b'p0'] = b'' | |
264 | for i, p in enumerate(parents, 1): |
|
268 | for i, p in enumerate(parents, 1): | |
265 |
metadata[b'p%i' % i] = |
|
269 | metadata[b'p%i' % i] = hex(p) | |
266 | metadata = _fm0encodemeta(metadata) |
|
270 | metadata = _fm0encodemeta(metadata) | |
267 | numsuc = len(sucs) |
|
271 | numsuc = len(sucs) | |
268 | format = _fm0fixed + (_fm0node * numsuc) |
|
272 | format = _fm0fixed + (_fm0node * numsuc) | |
@@ -529,7 +533,7 b' def _checkinvalidmarkers(markers):' | |||||
529 | subtle handling. |
|
533 | subtle handling. | |
530 | """ |
|
534 | """ | |
531 | for mark in markers: |
|
535 | for mark in markers: | |
532 |
if |
|
536 | if nullid in mark[1]: | |
533 | raise error.Abort( |
|
537 | raise error.Abort( | |
534 | _( |
|
538 | _( | |
535 | b'bad obsolescence marker detected: ' |
|
539 | b'bad obsolescence marker detected: ' | |
@@ -639,7 +643,7 b' class obsstore(object):' | |||||
639 | raise ValueError(succ) |
|
643 | raise ValueError(succ) | |
640 | if prec in succs: |
|
644 | if prec in succs: | |
641 | raise ValueError( |
|
645 | raise ValueError( | |
642 |
'in-marker cycle with %s' % pycompat.sysstr( |
|
646 | 'in-marker cycle with %s' % pycompat.sysstr(hex(prec)) | |
643 | ) |
|
647 | ) | |
644 |
|
648 | |||
645 | metadata = tuple(sorted(pycompat.iteritems(metadata))) |
|
649 | metadata = tuple(sorted(pycompat.iteritems(metadata))) | |
@@ -1031,7 +1035,7 b' def makefoldid(relation, user):' | |||||
1031 | folddigest.update(p.node()) |
|
1035 | folddigest.update(p.node()) | |
1032 | # Since fold only has to compete against fold for the same successors, it |
|
1036 | # Since fold only has to compete against fold for the same successors, it | |
1033 | # seems fine to use a small ID. Smaller ID save space. |
|
1037 | # seems fine to use a small ID. Smaller ID save space. | |
1034 |
return |
|
1038 | return hex(folddigest.digest())[:8] | |
1035 |
|
1039 | |||
1036 |
|
1040 | |||
1037 | def createmarkers( |
|
1041 | def createmarkers( |
@@ -10,11 +10,14 b' from __future__ import absolute_import' | |||||
10 | import re |
|
10 | import re | |
11 |
|
11 | |||
12 | from .i18n import _ |
|
12 | from .i18n import _ | |
|
13 | from .node import ( | |||
|
14 | hex, | |||
|
15 | short, | |||
|
16 | ) | |||
13 | from . import ( |
|
17 | from . import ( | |
14 | diffutil, |
|
18 | diffutil, | |
15 | encoding, |
|
19 | encoding, | |
16 | error, |
|
20 | error, | |
17 | node as nodemod, |
|
|||
18 | phases, |
|
21 | phases, | |
19 | pycompat, |
|
22 | pycompat, | |
20 | util, |
|
23 | util, | |
@@ -957,13 +960,13 b' def _getfilteredreason(repo, changeid, c' | |||||
957 | elif fate == b'diverged': |
|
960 | elif fate == b'diverged': | |
958 | return filteredmsgtable[b'diverged'] % changeid |
|
961 | return filteredmsgtable[b'diverged'] % changeid | |
959 | elif fate == b'superseded': |
|
962 | elif fate == b'superseded': | |
960 |
single_successor = |
|
963 | single_successor = short(successors[0][0]) | |
961 | return filteredmsgtable[b'superseded'] % (changeid, single_successor) |
|
964 | return filteredmsgtable[b'superseded'] % (changeid, single_successor) | |
962 | elif fate == b'superseded_split': |
|
965 | elif fate == b'superseded_split': | |
963 |
|
966 | |||
964 | succs = [] |
|
967 | succs = [] | |
965 | for node_id in successors[0]: |
|
968 | for node_id in successors[0]: | |
966 |
succs.append( |
|
969 | succs.append(short(node_id)) | |
967 |
|
970 | |||
968 | if len(succs) <= 2: |
|
971 | if len(succs) <= 2: | |
969 | fmtsuccs = b', '.join(succs) |
|
972 | fmtsuccs = b', '.join(succs) | |
@@ -1040,7 +1043,7 b' def whyunstable(repo, ctx):' | |||||
1040 | b'instability': b'content-divergent', |
|
1043 | b'instability': b'content-divergent', | |
1041 | b'divergentnodes': divnodes, |
|
1044 | b'divergentnodes': divnodes, | |
1042 | b'reason': b'predecessor', |
|
1045 | b'reason': b'predecessor', | |
1043 |
b'node': |
|
1046 | b'node': hex(dset[b'commonpredecessor']), | |
1044 | } |
|
1047 | } | |
1045 | ) |
|
1048 | ) | |
1046 | return result |
|
1049 | return result |
@@ -14,10 +14,10 b' import re' | |||||
14 | import struct |
|
14 | import struct | |
15 |
|
15 | |||
16 | from ..i18n import _ |
|
16 | from ..i18n import _ | |
|
17 | from ..node import hex | |||
17 |
|
18 | |||
18 | from .. import ( |
|
19 | from .. import ( | |
19 | error, |
|
20 | error, | |
20 | node as nodemod, |
|
|||
21 | util, |
|
21 | util, | |
22 | ) |
|
22 | ) | |
23 |
|
23 | |||
@@ -278,7 +278,7 b' def _make_uid():' | |||||
278 | """return a new unique identifier. |
|
278 | """return a new unique identifier. | |
279 |
|
279 | |||
280 | The identifier is random and composed of ascii characters.""" |
|
280 | The identifier is random and composed of ascii characters.""" | |
281 |
return |
|
281 | return hex(os.urandom(ID_SIZE)) | |
282 |
|
282 | |||
283 |
|
283 | |||
284 | class NodeMapDocket(object): |
|
284 | class NodeMapDocket(object): | |
@@ -461,8 +461,8 b' def _build_trie(index):' | |||||
461 | """ |
|
461 | """ | |
462 | root = Block() |
|
462 | root = Block() | |
463 | for rev in range(len(index)): |
|
463 | for rev in range(len(index)): | |
464 |
hex = |
|
464 | current_hex = hex(index[rev][7]) | |
465 | _insert_into_block(index, 0, root, rev, hex) |
|
465 | _insert_into_block(index, 0, root, rev, current_hex) | |
466 | return root |
|
466 | return root | |
467 |
|
467 | |||
468 |
|
468 | |||
@@ -470,8 +470,8 b' def _update_trie(index, root, last_rev):' | |||||
470 | """consume""" |
|
470 | """consume""" | |
471 | changed = 0 |
|
471 | changed = 0 | |
472 | for rev in range(last_rev + 1, len(index)): |
|
472 | for rev in range(last_rev + 1, len(index)): | |
473 |
hex = |
|
473 | current_hex = hex(index[rev][7]) | |
474 | changed += _insert_into_block(index, 0, root, rev, hex) |
|
474 | changed += _insert_into_block(index, 0, root, rev, current_hex) | |
475 | return changed, root |
|
475 | return changed, root | |
476 |
|
476 | |||
477 |
|
477 | |||
@@ -500,7 +500,7 b' def _insert_into_block(index, level, blo' | |||||
500 | else: |
|
500 | else: | |
501 | # collision with a previously unique prefix, inserting new |
|
501 | # collision with a previously unique prefix, inserting new | |
502 | # vertices to fit both entry. |
|
502 | # vertices to fit both entry. | |
503 |
other_hex = |
|
503 | other_hex = hex(index[entry][7]) | |
504 | other_rev = entry |
|
504 | other_rev = entry | |
505 | new = Block() |
|
505 | new = Block() | |
506 | block[hex_digit] = new |
|
506 | block[hex_digit] = new | |
@@ -604,7 +604,7 b' def check_data(ui, index, data):' | |||||
604 | ret = 1 |
|
604 | ret = 1 | |
605 | else: |
|
605 | else: | |
606 | all_revs.remove(r) |
|
606 | all_revs.remove(r) | |
607 |
nm_rev = _find_node(root, |
|
607 | nm_rev = _find_node(root, hex(index[r][7])) | |
608 | if nm_rev is None: |
|
608 | if nm_rev is None: | |
609 | msg = b" revision node does not match any entries: %d\n" % r |
|
609 | msg = b" revision node does not match any entries: %d\n" % r | |
610 | ui.write_err(msg) |
|
610 | ui.write_err(msg) |
@@ -11,6 +11,11 b' import re' | |||||
11 |
|
11 | |||
12 | from .i18n import _ |
|
12 | from .i18n import _ | |
13 | from .pycompat import getattr |
|
13 | from .pycompat import getattr | |
|
14 | from .node import ( | |||
|
15 | bin, | |||
|
16 | nullrev, | |||
|
17 | wdirrev, | |||
|
18 | ) | |||
14 | from . import ( |
|
19 | from . import ( | |
15 | dagop, |
|
20 | dagop, | |
16 | destutil, |
|
21 | destutil, | |
@@ -20,7 +25,6 b' from . import (' | |||||
20 | grep as grepmod, |
|
25 | grep as grepmod, | |
21 | hbisect, |
|
26 | hbisect, | |
22 | match as matchmod, |
|
27 | match as matchmod, | |
23 | node, |
|
|||
24 | obsolete as obsmod, |
|
28 | obsolete as obsmod, | |
25 | obsutil, |
|
29 | obsutil, | |
26 | pathutil, |
|
30 | pathutil, | |
@@ -55,7 +59,7 b' spanset = smartset.spanset' | |||||
55 | fullreposet = smartset.fullreposet |
|
59 | fullreposet = smartset.fullreposet | |
56 |
|
60 | |||
57 | # revisions not included in all(), but populated if specified |
|
61 | # revisions not included in all(), but populated if specified | |
58 |
_virtualrevs = ( |
|
62 | _virtualrevs = (nullrev, wdirrev) | |
59 |
|
63 | |||
60 | # Constants for ordering requirement, used in getset(): |
|
64 | # Constants for ordering requirement, used in getset(): | |
61 | # |
|
65 | # | |
@@ -177,9 +181,9 b' def rangepost(repo, subset, x, order):' | |||||
177 | def _makerangeset(repo, subset, m, n, order): |
|
181 | def _makerangeset(repo, subset, m, n, order): | |
178 | if m == n: |
|
182 | if m == n: | |
179 | r = baseset([m]) |
|
183 | r = baseset([m]) | |
180 |
elif n == |
|
184 | elif n == wdirrev: | |
181 | r = spanset(repo, m, len(repo)) + baseset([n]) |
|
185 | r = spanset(repo, m, len(repo)) + baseset([n]) | |
182 |
elif m == |
|
186 | elif m == wdirrev: | |
183 | r = baseset([m]) + spanset(repo, repo.changelog.tiprev(), n - 1) |
|
187 | r = baseset([m]) + spanset(repo, repo.changelog.tiprev(), n - 1) | |
184 | elif m < n: |
|
188 | elif m < n: | |
185 | r = spanset(repo, m, n + 1) |
|
189 | r = spanset(repo, m, n + 1) | |
@@ -597,7 +601,7 b' def bookmark(repo, subset, x):' | |||||
597 | bms.add(repo[bmrev].rev()) |
|
601 | bms.add(repo[bmrev].rev()) | |
598 | else: |
|
602 | else: | |
599 | bms = {repo[r].rev() for r in repo._bookmarks.values()} |
|
603 | bms = {repo[r].rev() for r in repo._bookmarks.values()} | |
600 |
bms -= { |
|
604 | bms -= {nullrev} | |
601 | return subset & bms |
|
605 | return subset & bms | |
602 |
|
606 | |||
603 |
|
607 | |||
@@ -722,7 +726,6 b' def _children(repo, subset, parentset):' | |||||
722 | cs = set() |
|
726 | cs = set() | |
723 | pr = repo.changelog.parentrevs |
|
727 | pr = repo.changelog.parentrevs | |
724 | minrev = parentset.min() |
|
728 | minrev = parentset.min() | |
725 | nullrev = node.nullrev |
|
|||
726 | for r in subset: |
|
729 | for r in subset: | |
727 | if r <= minrev: |
|
730 | if r <= minrev: | |
728 | continue |
|
731 | continue | |
@@ -1396,7 +1399,7 b' def _matchfiles(repo, subset, x):' | |||||
1396 | b'_matchfiles expected at most one revision' |
|
1399 | b'_matchfiles expected at most one revision' | |
1397 | ) |
|
1400 | ) | |
1398 | if value == b'': # empty means working directory |
|
1401 | if value == b'': # empty means working directory | |
1399 |
rev = |
|
1402 | rev = wdirrev | |
1400 | else: |
|
1403 | else: | |
1401 | rev = value |
|
1404 | rev = value | |
1402 | elif prefix == b'd:': |
|
1405 | elif prefix == b'd:': | |
@@ -1416,7 +1419,6 b' def _matchfiles(repo, subset, x):' | |||||
1416 | # This directly read the changelog data as creating changectx for all |
|
1419 | # This directly read the changelog data as creating changectx for all | |
1417 | # revisions is quite expensive. |
|
1420 | # revisions is quite expensive. | |
1418 | getfiles = repo.changelog.readfiles |
|
1421 | getfiles = repo.changelog.readfiles | |
1419 | wdirrev = node.wdirrev |
|
|||
1420 |
|
1422 | |||
1421 | def matches(x): |
|
1423 | def matches(x): | |
1422 | if x == wdirrev: |
|
1424 | if x == wdirrev: | |
@@ -1490,15 +1492,15 b' def heads(repo, subset, x, order):' | |||||
1490 | order = followorder |
|
1492 | order = followorder | |
1491 | inputset = getset(repo, fullreposet(repo), x, order=order) |
|
1493 | inputset = getset(repo, fullreposet(repo), x, order=order) | |
1492 | wdirparents = None |
|
1494 | wdirparents = None | |
1493 |
if |
|
1495 | if wdirrev in inputset: | |
1494 | # a bit slower, but not common so good enough for now |
|
1496 | # a bit slower, but not common so good enough for now | |
1495 | wdirparents = [p.rev() for p in repo[None].parents()] |
|
1497 | wdirparents = [p.rev() for p in repo[None].parents()] | |
1496 | inputset = set(inputset) |
|
1498 | inputset = set(inputset) | |
1497 |
inputset.discard( |
|
1499 | inputset.discard(wdirrev) | |
1498 | heads = repo.changelog.headrevs(inputset) |
|
1500 | heads = repo.changelog.headrevs(inputset) | |
1499 | if wdirparents is not None: |
|
1501 | if wdirparents is not None: | |
1500 | heads.difference_update(wdirparents) |
|
1502 | heads.difference_update(wdirparents) | |
1501 |
heads.add( |
|
1503 | heads.add(wdirrev) | |
1502 | heads = baseset(heads) |
|
1504 | heads = baseset(heads) | |
1503 | return subset & heads |
|
1505 | return subset & heads | |
1504 |
|
1506 | |||
@@ -1598,7 +1600,6 b' def merge(repo, subset, x):' | |||||
1598 | # i18n: "merge" is a keyword |
|
1600 | # i18n: "merge" is a keyword | |
1599 | getargs(x, 0, 0, _(b"merge takes no arguments")) |
|
1601 | getargs(x, 0, 0, _(b"merge takes no arguments")) | |
1600 | cl = repo.changelog |
|
1602 | cl = repo.changelog | |
1601 | nullrev = node.nullrev |
|
|||
1602 |
|
1603 | |||
1603 | def ismerge(r): |
|
1604 | def ismerge(r): | |
1604 | try: |
|
1605 | try: | |
@@ -1692,7 +1693,7 b' def named(repo, subset, x):' | |||||
1692 | if name not in ns.deprecated: |
|
1693 | if name not in ns.deprecated: | |
1693 | names.update(repo[n].rev() for n in ns.nodes(repo, name)) |
|
1694 | names.update(repo[n].rev() for n in ns.nodes(repo, name)) | |
1694 |
|
1695 | |||
1695 |
names -= { |
|
1696 | names -= {nullrev} | |
1696 | return subset & names |
|
1697 | return subset & names | |
1697 |
|
1698 | |||
1698 |
|
1699 | |||
@@ -1705,9 +1706,9 b' def node_(repo, subset, x):' | |||||
1705 | n = getstring(l[0], _(b"id requires a string")) |
|
1706 | n = getstring(l[0], _(b"id requires a string")) | |
1706 | if len(n) == 40: |
|
1707 | if len(n) == 40: | |
1707 | try: |
|
1708 | try: | |
1708 |
rn = repo.changelog.rev( |
|
1709 | rn = repo.changelog.rev(bin(n)) | |
1709 | except error.WdirUnsupported: |
|
1710 | except error.WdirUnsupported: | |
1710 |
rn = |
|
1711 | rn = wdirrev | |
1711 | except (LookupError, TypeError): |
|
1712 | except (LookupError, TypeError): | |
1712 | rn = None |
|
1713 | rn = None | |
1713 | else: |
|
1714 | else: | |
@@ -1719,7 +1720,7 b' def node_(repo, subset, x):' | |||||
1719 | except LookupError: |
|
1720 | except LookupError: | |
1720 | pass |
|
1721 | pass | |
1721 | except error.WdirUnsupported: |
|
1722 | except error.WdirUnsupported: | |
1722 |
rn = |
|
1723 | rn = wdirrev | |
1723 |
|
1724 | |||
1724 | if rn is None: |
|
1725 | if rn is None: | |
1725 | return baseset() |
|
1726 | return baseset() | |
@@ -1864,7 +1865,7 b' def p1(repo, subset, x):' | |||||
1864 | ps.add(cl.parentrevs(r)[0]) |
|
1865 | ps.add(cl.parentrevs(r)[0]) | |
1865 | except error.WdirUnsupported: |
|
1866 | except error.WdirUnsupported: | |
1866 | ps.add(repo[r].p1().rev()) |
|
1867 | ps.add(repo[r].p1().rev()) | |
1867 |
ps -= { |
|
1868 | ps -= {nullrev} | |
1868 | # XXX we should turn this into a baseset instead of a set, smartset may do |
|
1869 | # XXX we should turn this into a baseset instead of a set, smartset may do | |
1869 | # some optimizations from the fact this is a baseset. |
|
1870 | # some optimizations from the fact this is a baseset. | |
1870 | return subset & ps |
|
1871 | return subset & ps | |
@@ -1892,7 +1893,7 b' def p2(repo, subset, x):' | |||||
1892 | parents = repo[r].parents() |
|
1893 | parents = repo[r].parents() | |
1893 | if len(parents) == 2: |
|
1894 | if len(parents) == 2: | |
1894 | ps.add(parents[1]) |
|
1895 | ps.add(parents[1]) | |
1895 |
ps -= { |
|
1896 | ps -= {nullrev} | |
1896 | # XXX we should turn this into a baseset instead of a set, smartset may do |
|
1897 | # XXX we should turn this into a baseset instead of a set, smartset may do | |
1897 | # some optimizations from the fact this is a baseset. |
|
1898 | # some optimizations from the fact this is a baseset. | |
1898 | return subset & ps |
|
1899 | return subset & ps | |
@@ -1919,7 +1920,7 b' def parents(repo, subset, x):' | |||||
1919 | up(parentrevs(r)) |
|
1920 | up(parentrevs(r)) | |
1920 | except error.WdirUnsupported: |
|
1921 | except error.WdirUnsupported: | |
1921 | up(p.rev() for p in repo[r].parents()) |
|
1922 | up(p.rev() for p in repo[r].parents()) | |
1922 |
ps -= { |
|
1923 | ps -= {nullrev} | |
1923 | return subset & ps |
|
1924 | return subset & ps | |
1924 |
|
1925 | |||
1925 |
|
1926 | |||
@@ -1994,7 +1995,7 b' def parentspec(repo, subset, x, n, order' | |||||
1994 | else: |
|
1995 | else: | |
1995 | try: |
|
1996 | try: | |
1996 | parents = cl.parentrevs(r) |
|
1997 | parents = cl.parentrevs(r) | |
1997 |
if parents[1] != |
|
1998 | if parents[1] != nullrev: | |
1998 | ps.add(parents[1]) |
|
1999 | ps.add(parents[1]) | |
1999 | except error.WdirUnsupported: |
|
2000 | except error.WdirUnsupported: | |
2000 | parents = repo[r].parents() |
|
2001 | parents = repo[r].parents() | |
@@ -2567,8 +2568,8 b' def wdir(repo, subset, x):' | |||||
2567 | """Working directory. (EXPERIMENTAL)""" |
|
2568 | """Working directory. (EXPERIMENTAL)""" | |
2568 | # i18n: "wdir" is a keyword |
|
2569 | # i18n: "wdir" is a keyword | |
2569 | getargs(x, 0, 0, _(b"wdir takes no arguments")) |
|
2570 | getargs(x, 0, 0, _(b"wdir takes no arguments")) | |
2570 |
if |
|
2571 | if wdirrev in subset or isinstance(subset, fullreposet): | |
2571 |
return baseset([ |
|
2572 | return baseset([wdirrev]) | |
2572 | return baseset() |
|
2573 | return baseset() | |
2573 |
|
2574 | |||
2574 |
|
2575 | |||
@@ -2638,7 +2639,7 b' def _orderedhexlist(repo, subset, x):' | |||||
2638 | if not s: |
|
2639 | if not s: | |
2639 | return baseset() |
|
2640 | return baseset() | |
2640 | cl = repo.changelog |
|
2641 | cl = repo.changelog | |
2641 |
ls = [cl.rev( |
|
2642 | ls = [cl.rev(bin(r)) for r in s.split(b'\0')] | |
2642 | s = subset |
|
2643 | s = subset | |
2643 | return baseset([r for r in ls if r in s]) |
|
2644 | return baseset([r for r in ls if r in s]) | |
2644 |
|
2645 |
@@ -11,9 +11,9 b' import string' | |||||
11 |
|
11 | |||
12 | from .i18n import _ |
|
12 | from .i18n import _ | |
13 | from .pycompat import getattr |
|
13 | from .pycompat import getattr | |
|
14 | from .node import hex | |||
14 | from . import ( |
|
15 | from . import ( | |
15 | error, |
|
16 | error, | |
16 | node, |
|
|||
17 | parser, |
|
17 | parser, | |
18 | pycompat, |
|
18 | pycompat, | |
19 | smartset, |
|
19 | smartset, | |
@@ -687,7 +687,7 b' def _formatargtype(c, arg):' | |||||
687 | parse(arg) # make sure syntax errors are confined |
|
687 | parse(arg) # make sure syntax errors are confined | |
688 | return b'(%s)' % arg |
|
688 | return b'(%s)' % arg | |
689 | elif c == b'n': |
|
689 | elif c == b'n': | |
690 |
return _quote( |
|
690 | return _quote(hex(arg)) | |
691 | elif c == b'b': |
|
691 | elif c == b'b': | |
692 | try: |
|
692 | try: | |
693 | return _quote(arg.branch()) |
|
693 | return _quote(arg.branch()) | |
@@ -707,7 +707,7 b' def _formatlistexp(s, t):' | |||||
707 | elif t == b's': |
|
707 | elif t == b's': | |
708 | return b"_list(%s)" % _quote(b"\0".join(s)) |
|
708 | return b"_list(%s)" % _quote(b"\0".join(s)) | |
709 | elif t == b'n': |
|
709 | elif t == b'n': | |
710 |
return b"_hexlist('%s')" % b"\0".join( |
|
710 | return b"_hexlist('%s')" % b"\0".join(hex(a) for a in s) | |
711 | elif t == b'b': |
|
711 | elif t == b'b': | |
712 | try: |
|
712 | try: | |
713 | return b"_list('%s')" % b"\0".join(a.branch() for a in s) |
|
713 | return b"_list('%s')" % b"\0".join(a.branch() for a in s) |
@@ -10,10 +10,13 b' from __future__ import absolute_import' | |||||
10 | import re |
|
10 | import re | |
11 |
|
11 | |||
12 | from .i18n import _ |
|
12 | from .i18n import _ | |
|
13 | from .node import ( | |||
|
14 | hex, | |||
|
15 | nullrev, | |||
|
16 | ) | |||
13 |
|
17 | |||
14 | from . import ( |
|
18 | from . import ( | |
15 | error, |
|
19 | error, | |
16 | node, |
|
|||
17 | obsolete, |
|
20 | obsolete, | |
18 | obsutil, |
|
21 | obsutil, | |
19 | revset, |
|
22 | revset, | |
@@ -30,7 +33,7 b" def precheck(repo, revs, action=b'rewrit" | |||||
30 |
|
33 | |||
31 | Make sure this function is called after taking the lock. |
|
34 | Make sure this function is called after taking the lock. | |
32 | """ |
|
35 | """ | |
33 |
if |
|
36 | if nullrev in revs: | |
34 | msg = _(b"cannot %s null changeset") % action |
|
37 | msg = _(b"cannot %s null changeset") % action | |
35 | hint = _(b"no changeset checked out") |
|
38 | hint = _(b"no changeset checked out") | |
36 | raise error.InputError(msg, hint=hint) |
|
39 | raise error.InputError(msg, hint=hint) | |
@@ -113,7 +116,7 b' def update_hash_refs(repo, commitmsg, pe' | |||||
113 | if len(successors) == 1 and len(successors[0]) == 1: |
|
116 | if len(successors) == 1 and len(successors[0]) == 1: | |
114 | successor = successors[0][0] |
|
117 | successor = successors[0][0] | |
115 | if successor is not None: |
|
118 | if successor is not None: | |
116 |
newhash = |
|
119 | newhash = hex(successor) | |
117 | commitmsg = commitmsg.replace(h, newhash[: len(h)]) |
|
120 | commitmsg = commitmsg.replace(h, newhash[: len(h)]) | |
118 | else: |
|
121 | else: | |
119 | repo.ui.note( |
|
122 | repo.ui.note( |
@@ -29,6 +29,12 b' import stat' | |||||
29 |
|
29 | |||
30 | from .i18n import _ |
|
30 | from .i18n import _ | |
31 | from .pycompat import open |
|
31 | from .pycompat import open | |
|
32 | from .node import ( | |||
|
33 | bin, | |||
|
34 | hex, | |||
|
35 | nullid, | |||
|
36 | nullrev, | |||
|
37 | ) | |||
32 | from . import ( |
|
38 | from . import ( | |
33 | bookmarks, |
|
39 | bookmarks, | |
34 | bundle2, |
|
40 | bundle2, | |
@@ -43,7 +49,6 b' from . import (' | |||||
43 | mdiff, |
|
49 | mdiff, | |
44 | merge, |
|
50 | merge, | |
45 | mergestate as mergestatemod, |
|
51 | mergestate as mergestatemod, | |
46 | node as nodemod, |
|
|||
47 | patch, |
|
52 | patch, | |
48 | phases, |
|
53 | phases, | |
49 | pycompat, |
|
54 | pycompat, | |
@@ -196,11 +201,11 b' class shelvedstate(object):' | |||||
196 | def _verifyandtransform(cls, d): |
|
201 | def _verifyandtransform(cls, d): | |
197 | """Some basic shelvestate syntactic verification and transformation""" |
|
202 | """Some basic shelvestate syntactic verification and transformation""" | |
198 | try: |
|
203 | try: | |
199 |
d[b'originalwctx'] = |
|
204 | d[b'originalwctx'] = bin(d[b'originalwctx']) | |
200 |
d[b'pendingctx'] = |
|
205 | d[b'pendingctx'] = bin(d[b'pendingctx']) | |
201 |
d[b'parents'] = [ |
|
206 | d[b'parents'] = [bin(h) for h in d[b'parents'].split(b' ')] | |
202 | d[b'nodestoremove'] = [ |
|
207 | d[b'nodestoremove'] = [ | |
203 |
|
|
208 | bin(h) for h in d[b'nodestoremove'].split(b' ') | |
204 | ] |
|
209 | ] | |
205 | except (ValueError, TypeError, KeyError) as err: |
|
210 | except (ValueError, TypeError, KeyError) as err: | |
206 | raise error.CorruptedState(pycompat.bytestr(err)) |
|
211 | raise error.CorruptedState(pycompat.bytestr(err)) | |
@@ -296,14 +301,10 b' class shelvedstate(object):' | |||||
296 | ): |
|
301 | ): | |
297 | info = { |
|
302 | info = { | |
298 | b"name": name, |
|
303 | b"name": name, | |
299 |
b"originalwctx": |
|
304 | b"originalwctx": hex(originalwctx.node()), | |
300 |
b"pendingctx": |
|
305 | b"pendingctx": hex(pendingctx.node()), | |
301 | b"parents": b' '.join( |
|
306 | b"parents": b' '.join([hex(p) for p in repo.dirstate.parents()]), | |
302 | [nodemod.hex(p) for p in repo.dirstate.parents()] |
|
307 | b"nodestoremove": b' '.join([hex(n) for n in nodestoremove]), | |
303 | ), |
|
|||
304 | b"nodestoremove": b' '.join( |
|
|||
305 | [nodemod.hex(n) for n in nodestoremove] |
|
|||
306 | ), |
|
|||
307 | b"branchtorestore": branchtorestore, |
|
308 | b"branchtorestore": branchtorestore, | |
308 | b"keep": cls._keep if keep else cls._nokeep, |
|
309 | b"keep": cls._keep if keep else cls._nokeep, | |
309 | b"activebook": activebook or cls._noactivebook, |
|
310 | b"activebook": activebook or cls._noactivebook, | |
@@ -400,7 +401,7 b' def mutableancestors(ctx):' | |||||
400 | """return all mutable ancestors for ctx (included) |
|
401 | """return all mutable ancestors for ctx (included) | |
401 |
|
402 | |||
402 | Much faster than the revset ancestors(ctx) & draft()""" |
|
403 | Much faster than the revset ancestors(ctx) & draft()""" | |
403 |
seen = { |
|
404 | seen = {nullrev} | |
404 | visit = collections.deque() |
|
405 | visit = collections.deque() | |
405 | visit.append(ctx) |
|
406 | visit.append(ctx) | |
406 | while visit: |
|
407 | while visit: | |
@@ -464,7 +465,7 b' def _nothingtoshelvemessaging(ui, repo, ' | |||||
464 |
|
465 | |||
465 |
|
466 | |||
466 | def _shelvecreatedcommit(repo, node, name, match): |
|
467 | def _shelvecreatedcommit(repo, node, name, match): | |
467 |
info = {b'node': |
|
468 | info = {b'node': hex(node)} | |
468 | shelvedfile(repo, name, b'shelve').writeinfo(info) |
|
469 | shelvedfile(repo, name, b'shelve').writeinfo(info) | |
469 | bases = list(mutableancestors(repo[node])) |
|
470 | bases = list(mutableancestors(repo[node])) | |
470 | shelvedfile(repo, name, b'hg').writebundle(bases, node) |
|
471 | shelvedfile(repo, name, b'hg').writebundle(bases, node) | |
@@ -501,7 +502,7 b' def _docreatecmd(ui, repo, pats, opts):' | |||||
501 | parent = parents[0] |
|
502 | parent = parents[0] | |
502 | origbranch = wctx.branch() |
|
503 | origbranch = wctx.branch() | |
503 |
|
504 | |||
504 |
if parent.node() != |
|
505 | if parent.node() != nullid: | |
505 | desc = b"changes to: %s" % parent.description().split(b'\n', 1)[0] |
|
506 | desc = b"changes to: %s" % parent.description().split(b'\n', 1)[0] | |
506 | else: |
|
507 | else: | |
507 | desc = b'(changes in empty repository)' |
|
508 | desc = b'(changes in empty repository)' | |
@@ -816,7 +817,7 b' def unshelvecontinue(ui, repo, state, op' | |||||
816 | pendingctx = state.pendingctx |
|
817 | pendingctx = state.pendingctx | |
817 |
|
818 | |||
818 | with repo.dirstate.parentchange(): |
|
819 | with repo.dirstate.parentchange(): | |
819 |
repo.setparents(state.pendingctx.node(), |
|
820 | repo.setparents(state.pendingctx.node(), nullid) | |
820 | repo.dirstate.write(repo.currenttransaction()) |
|
821 | repo.dirstate.write(repo.currenttransaction()) | |
821 |
|
822 | |||
822 | targetphase = phases.internal |
|
823 | targetphase = phases.internal | |
@@ -825,7 +826,7 b' def unshelvecontinue(ui, repo, state, op' | |||||
825 | overrides = {(b'phases', b'new-commit'): targetphase} |
|
826 | overrides = {(b'phases', b'new-commit'): targetphase} | |
826 | with repo.ui.configoverride(overrides, b'unshelve'): |
|
827 | with repo.ui.configoverride(overrides, b'unshelve'): | |
827 | with repo.dirstate.parentchange(): |
|
828 | with repo.dirstate.parentchange(): | |
828 |
repo.setparents(state.parents[0], |
|
829 | repo.setparents(state.parents[0], nullid) | |
829 | newnode, ispartialunshelve = _createunshelvectx( |
|
830 | newnode, ispartialunshelve = _createunshelvectx( | |
830 | ui, repo, shelvectx, basename, interactive, opts |
|
831 | ui, repo, shelvectx, basename, interactive, opts | |
831 | ) |
|
832 | ) | |
@@ -901,7 +902,7 b' def _unshelverestorecommit(ui, repo, tr,' | |||||
901 | # We might not strip the unbundled changeset, so we should keep track of |
|
902 | # We might not strip the unbundled changeset, so we should keep track of | |
902 | # the unshelve node in case we need to reuse it (eg: unshelve --keep) |
|
903 | # the unshelve node in case we need to reuse it (eg: unshelve --keep) | |
903 | if node is None: |
|
904 | if node is None: | |
904 |
info = {b'node': |
|
905 | info = {b'node': hex(shelvectx.node())} | |
905 | shelvedfile(repo, basename, b'shelve').writeinfo(info) |
|
906 | shelvedfile(repo, basename, b'shelve').writeinfo(info) | |
906 | else: |
|
907 | else: | |
907 | shelvectx = repo[node] |
|
908 | shelvectx = repo[node] | |
@@ -1020,7 +1021,7 b' def _rebaserestoredcommit(' | |||||
1020 | raise error.ConflictResolutionRequired(b'unshelve') |
|
1021 | raise error.ConflictResolutionRequired(b'unshelve') | |
1021 |
|
1022 | |||
1022 | with repo.dirstate.parentchange(): |
|
1023 | with repo.dirstate.parentchange(): | |
1023 |
repo.setparents(tmpwctx.node(), |
|
1024 | repo.setparents(tmpwctx.node(), nullid) | |
1024 | newnode, ispartialunshelve = _createunshelvectx( |
|
1025 | newnode, ispartialunshelve = _createunshelvectx( | |
1025 | ui, repo, shelvectx, basename, interactive, opts |
|
1026 | ui, repo, shelvectx, basename, interactive, opts | |
1026 | ) |
|
1027 | ) |
@@ -19,10 +19,10 b'' | |||||
19 | from __future__ import absolute_import |
|
19 | from __future__ import absolute_import | |
20 |
|
20 | |||
21 | from .i18n import _ |
|
21 | from .i18n import _ | |
|
22 | from .node import nullid | |||
22 | from . import ( |
|
23 | from . import ( | |
23 | error, |
|
24 | error, | |
24 | mdiff, |
|
25 | mdiff, | |
25 | node as nodemod, |
|
|||
26 | pycompat, |
|
26 | pycompat, | |
27 | util, |
|
27 | util, | |
28 | ) |
|
28 | ) | |
@@ -452,7 +452,7 b' def _picklabels(defaults, overrides):' | |||||
452 | def is_not_null(ctx): |
|
452 | def is_not_null(ctx): | |
453 | if not util.safehasattr(ctx, "node"): |
|
453 | if not util.safehasattr(ctx, "node"): | |
454 | return False |
|
454 | return False | |
455 |
return ctx.node() != |
|
455 | return ctx.node() != nullid | |
456 |
|
456 | |||
457 |
|
457 | |||
458 | def _mergediff(m3, name_a, name_b, name_base): |
|
458 | def _mergediff(m3, name_a, name_b, name_base): |
@@ -16,10 +16,10 b' import ssl' | |||||
16 |
|
16 | |||
17 | from .i18n import _ |
|
17 | from .i18n import _ | |
18 | from .pycompat import getattr |
|
18 | from .pycompat import getattr | |
|
19 | from .node import hex | |||
19 | from . import ( |
|
20 | from . import ( | |
20 | encoding, |
|
21 | encoding, | |
21 | error, |
|
22 | error, | |
22 | node, |
|
|||
23 | pycompat, |
|
23 | pycompat, | |
24 | util, |
|
24 | util, | |
25 | ) |
|
25 | ) | |
@@ -762,9 +762,9 b' def validatesocket(sock):' | |||||
762 | # If a certificate fingerprint is pinned, use it and only it to |
|
762 | # If a certificate fingerprint is pinned, use it and only it to | |
763 | # validate the remote cert. |
|
763 | # validate the remote cert. | |
764 | peerfingerprints = { |
|
764 | peerfingerprints = { | |
765 |
b'sha1': |
|
765 | b'sha1': hex(hashutil.sha1(peercert).digest()), | |
766 |
b'sha256': |
|
766 | b'sha256': hex(hashlib.sha256(peercert).digest()), | |
767 |
b'sha512': |
|
767 | b'sha512': hex(hashlib.sha512(peercert).digest()), | |
768 | } |
|
768 | } | |
769 |
|
769 | |||
770 | def fmtfingerprint(s): |
|
770 | def fmtfingerprint(s): |
@@ -14,11 +14,11 b' import stat' | |||||
14 |
|
14 | |||
15 | from .i18n import _ |
|
15 | from .i18n import _ | |
16 | from .pycompat import getattr |
|
16 | from .pycompat import getattr | |
|
17 | from .node import hex | |||
17 | from . import ( |
|
18 | from . import ( | |
18 | changelog, |
|
19 | changelog, | |
19 | error, |
|
20 | error, | |
20 | manifest, |
|
21 | manifest, | |
21 | node, |
|
|||
22 | policy, |
|
22 | policy, | |
23 | pycompat, |
|
23 | pycompat, | |
24 | util, |
|
24 | util, | |
@@ -273,7 +273,7 b' def _auxencode(path, dotencode):' | |||||
273 |
|
273 | |||
274 |
|
274 | |||
275 | def _hashencode(path, dotencode): |
|
275 | def _hashencode(path, dotencode): | |
276 |
digest = |
|
276 | digest = hex(hashutil.sha1(path).digest()) | |
277 | le = lowerencode(path[5:]).split(b'/') # skips prefix 'data/' or 'meta/' |
|
277 | le = lowerencode(path[5:]).split(b'/') # skips prefix 'data/' or 'meta/' | |
278 | parts = _auxencode(le, dotencode) |
|
278 | parts = _auxencode(le, dotencode) | |
279 | basename = parts[-1] |
|
279 | basename = parts[-1] |
@@ -2,6 +2,7 b' from __future__ import absolute_import' | |||||
2 |
|
2 | |||
3 | from .i18n import _ |
|
3 | from .i18n import _ | |
4 | from .pycompat import getattr |
|
4 | from .pycompat import getattr | |
|
5 | from .node import nullid | |||
5 | from . import ( |
|
6 | from . import ( | |
6 | bookmarks as bookmarksmod, |
|
7 | bookmarks as bookmarksmod, | |
7 | cmdutil, |
|
8 | cmdutil, | |
@@ -9,7 +10,6 b' from . import (' | |||||
9 | hg, |
|
10 | hg, | |
10 | lock as lockmod, |
|
11 | lock as lockmod, | |
11 | mergestate as mergestatemod, |
|
12 | mergestate as mergestatemod, | |
12 | node as nodemod, |
|
|||
13 | pycompat, |
|
13 | pycompat, | |
14 | registrar, |
|
14 | registrar, | |
15 | repair, |
|
15 | repair, | |
@@ -17,7 +17,6 b' from . import (' | |||||
17 | util, |
|
17 | util, | |
18 | ) |
|
18 | ) | |
19 |
|
19 | |||
20 | nullid = nodemod.nullid |
|
|||
21 | release = lockmod.release |
|
20 | release = lockmod.release | |
22 |
|
21 | |||
23 | cmdtable = {} |
|
22 | cmdtable = {} |
@@ -18,6 +18,12 b' import tarfile' | |||||
18 | import xml.dom.minidom |
|
18 | import xml.dom.minidom | |
19 |
|
19 | |||
20 | from .i18n import _ |
|
20 | from .i18n import _ | |
|
21 | from .node import ( | |||
|
22 | bin, | |||
|
23 | hex, | |||
|
24 | nullid, | |||
|
25 | short, | |||
|
26 | ) | |||
21 | from . import ( |
|
27 | from . import ( | |
22 | cmdutil, |
|
28 | cmdutil, | |
23 | encoding, |
|
29 | encoding, | |
@@ -26,7 +32,6 b' from . import (' | |||||
26 | logcmdutil, |
|
32 | logcmdutil, | |
27 | match as matchmod, |
|
33 | match as matchmod, | |
28 | merge as merge, |
|
34 | merge as merge, | |
29 | node, |
|
|||
30 | pathutil, |
|
35 | pathutil, | |
31 | phases, |
|
36 | phases, | |
32 | pycompat, |
|
37 | pycompat, | |
@@ -61,7 +66,7 b' def _expandedabspath(path):' | |||||
61 |
|
66 | |||
62 | def _getstorehashcachename(remotepath): |
|
67 | def _getstorehashcachename(remotepath): | |
63 | '''get a unique filename for the store hash cache of a remote repository''' |
|
68 | '''get a unique filename for the store hash cache of a remote repository''' | |
64 |
return |
|
69 | return hex(hashutil.sha1(_expandedabspath(remotepath)).digest())[0:12] | |
65 |
|
70 | |||
66 |
|
71 | |||
67 | class SubrepoAbort(error.Abort): |
|
72 | class SubrepoAbort(error.Abort): | |
@@ -508,7 +513,7 b' class hgsubrepo(abstractsubrepo):' | |||||
508 | yield b'# %s\n' % _expandedabspath(remotepath) |
|
513 | yield b'# %s\n' % _expandedabspath(remotepath) | |
509 | vfs = self._repo.vfs |
|
514 | vfs = self._repo.vfs | |
510 | for relname in filelist: |
|
515 | for relname in filelist: | |
511 |
filehash = |
|
516 | filehash = hex(hashutil.sha1(vfs.tryread(relname)).digest()) | |
512 | yield b'%s = %s\n' % (relname, filehash) |
|
517 | yield b'%s = %s\n' % (relname, filehash) | |
513 |
|
518 | |||
514 | @propertycache |
|
519 | @propertycache | |
@@ -601,11 +606,11 b' class hgsubrepo(abstractsubrepo):' | |||||
601 | @annotatesubrepoerror |
|
606 | @annotatesubrepoerror | |
602 | def diff(self, ui, diffopts, node2, match, prefix, **opts): |
|
607 | def diff(self, ui, diffopts, node2, match, prefix, **opts): | |
603 | try: |
|
608 | try: | |
604 |
node1 = |
|
609 | node1 = bin(self._state[1]) | |
605 | # We currently expect node2 to come from substate and be |
|
610 | # We currently expect node2 to come from substate and be | |
606 | # in hex format |
|
611 | # in hex format | |
607 | if node2 is not None: |
|
612 | if node2 is not None: | |
608 |
node2 = |
|
613 | node2 = bin(node2) | |
609 | logcmdutil.diffordiffstat( |
|
614 | logcmdutil.diffordiffstat( | |
610 | ui, |
|
615 | ui, | |
611 | self._repo, |
|
616 | self._repo, | |
@@ -669,7 +674,7 b' class hgsubrepo(abstractsubrepo):' | |||||
669 | n = self._repo.commit(text, user, date) |
|
674 | n = self._repo.commit(text, user, date) | |
670 | if not n: |
|
675 | if not n: | |
671 | return self._repo[b'.'].hex() # different version checked out |
|
676 | return self._repo[b'.'].hex() # different version checked out | |
672 |
return |
|
677 | return hex(n) | |
673 |
|
678 | |||
674 | @annotatesubrepoerror |
|
679 | @annotatesubrepoerror | |
675 | def phase(self, state): |
|
680 | def phase(self, state): | |
@@ -680,7 +685,7 b' class hgsubrepo(abstractsubrepo):' | |||||
680 | # we can't fully delete the repository as it may contain |
|
685 | # we can't fully delete the repository as it may contain | |
681 | # local-only history |
|
686 | # local-only history | |
682 | self.ui.note(_(b'removing subrepo %s\n') % subrelpath(self)) |
|
687 | self.ui.note(_(b'removing subrepo %s\n') % subrelpath(self)) | |
683 |
hg.clean(self._repo, |
|
688 | hg.clean(self._repo, nullid, False) | |
684 |
|
689 | |||
685 | def _get(self, state): |
|
690 | def _get(self, state): | |
686 | source, revision, kind = state |
|
691 | source, revision, kind = state | |
@@ -1019,7 +1024,7 b' class hgsubrepo(abstractsubrepo):' | |||||
1019 | # explicit warning. |
|
1024 | # explicit warning. | |
1020 | msg = _(b"subrepo '%s' is hidden in revision %s") % ( |
|
1025 | msg = _(b"subrepo '%s' is hidden in revision %s") % ( | |
1021 | self._relpath, |
|
1026 | self._relpath, | |
1022 |
|
|
1027 | short(self._ctx.node()), | |
1023 | ) |
|
1028 | ) | |
1024 |
|
1029 | |||
1025 | if onpush: |
|
1030 | if onpush: | |
@@ -1032,7 +1037,7 b' class hgsubrepo(abstractsubrepo):' | |||||
1032 | # don't treat this as an error for `hg verify`. |
|
1037 | # don't treat this as an error for `hg verify`. | |
1033 | msg = _(b"subrepo '%s' not found in revision %s") % ( |
|
1038 | msg = _(b"subrepo '%s' not found in revision %s") % ( | |
1034 | self._relpath, |
|
1039 | self._relpath, | |
1035 |
|
|
1040 | short(self._ctx.node()), | |
1036 | ) |
|
1041 | ) | |
1037 |
|
1042 | |||
1038 | if onpush: |
|
1043 | if onpush: |
@@ -75,16 +75,13 b' from __future__ import absolute_import' | |||||
75 |
|
75 | |||
76 | from .i18n import _ |
|
76 | from .i18n import _ | |
77 | from .node import ( |
|
77 | from .node import ( | |
78 | hex, |
|
78 | nullhex, | |
79 | nullid, |
|
|||
80 | ) |
|
79 | ) | |
81 | from . import ( |
|
80 | from . import ( | |
82 | tags as tagsmod, |
|
81 | tags as tagsmod, | |
83 | util, |
|
82 | util, | |
84 | ) |
|
83 | ) | |
85 |
|
84 | |||
86 | hexnullid = hex(nullid) |
|
|||
87 |
|
||||
88 |
|
85 | |||
89 | def readtagsformerge(ui, repo, lines, fn=b'', keeplinenums=False): |
|
86 | def readtagsformerge(ui, repo, lines, fn=b'', keeplinenums=False): | |
90 | """read the .hgtags file into a structure that is suitable for merging |
|
87 | """read the .hgtags file into a structure that is suitable for merging | |
@@ -246,8 +243,8 b' def merge(repo, fcd, fco, fca):' | |||||
246 | pnlosttagset = basetagset - pntagset |
|
243 | pnlosttagset = basetagset - pntagset | |
247 | for t in pnlosttagset: |
|
244 | for t in pnlosttagset: | |
248 | pntags[t] = basetags[t] |
|
245 | pntags[t] = basetags[t] | |
249 |
if pntags[t][-1][0] != |
|
246 | if pntags[t][-1][0] != nullhex: | |
250 |
pntags[t].append([ |
|
247 | pntags[t].append([nullhex, None]) | |
251 |
|
248 | |||
252 | conflictedtags = [] # for reporting purposes |
|
249 | conflictedtags = [] # for reporting purposes | |
253 | mergedtags = util.sortdict(p1tags) |
|
250 | mergedtags = util.sortdict(p1tags) |
@@ -12,10 +12,10 b' import re' | |||||
12 | import time |
|
12 | import time | |
13 |
|
13 | |||
14 | from .i18n import _ |
|
14 | from .i18n import _ | |
|
15 | from .node import hex | |||
15 | from . import ( |
|
16 | from . import ( | |
16 | encoding, |
|
17 | encoding, | |
17 | error, |
|
18 | error, | |
18 | node, |
|
|||
19 | pycompat, |
|
19 | pycompat, | |
20 | registrar, |
|
20 | registrar, | |
21 | smartset, |
|
21 | smartset, | |
@@ -280,7 +280,7 b' def hexfilter(text):' | |||||
280 | """Any text. Convert a binary Mercurial node identifier into |
|
280 | """Any text. Convert a binary Mercurial node identifier into | |
281 | its long hexadecimal representation. |
|
281 | its long hexadecimal representation. | |
282 | """ |
|
282 | """ | |
283 |
return |
|
283 | return hex(text) | |
284 |
|
284 | |||
285 |
|
285 | |||
286 | @templatefilter(b'hgdate', intype=templateutil.date) |
|
286 | @templatefilter(b'hgdate', intype=templateutil.date) |
@@ -42,12 +42,12 b' from .pycompat import (' | |||||
42 | open, |
|
42 | open, | |
43 | setattr, |
|
43 | setattr, | |
44 | ) |
|
44 | ) | |
|
45 | from .node import hex | |||
45 | from hgdemandimport import tracing |
|
46 | from hgdemandimport import tracing | |
46 | from . import ( |
|
47 | from . import ( | |
47 | encoding, |
|
48 | encoding, | |
48 | error, |
|
49 | error, | |
49 | i18n, |
|
50 | i18n, | |
50 | node as nodemod, |
|
|||
51 | policy, |
|
51 | policy, | |
52 | pycompat, |
|
52 | pycompat, | |
53 | urllibcompat, |
|
53 | urllibcompat, | |
@@ -254,7 +254,7 b' class digester(object):' | |||||
254 | def __getitem__(self, key): |
|
254 | def __getitem__(self, key): | |
255 | if key not in DIGESTS: |
|
255 | if key not in DIGESTS: | |
256 | raise error.Abort(_(b'unknown digest type: %s') % k) |
|
256 | raise error.Abort(_(b'unknown digest type: %s') % k) | |
257 |
return |
|
257 | return hex(self._hashes[key].digest()) | |
258 |
|
258 | |||
259 | def __iter__(self): |
|
259 | def __iter__(self): | |
260 | return iter(self._hashes) |
|
260 | return iter(self._hashes) |
@@ -86,11 +86,11 b' import collections' | |||||
86 | import itertools |
|
86 | import itertools | |
87 | import re |
|
87 | import re | |
88 |
|
88 | |||
|
89 | from mercurial.node import nullid | |||
89 | from mercurial.i18n import _ |
|
90 | from mercurial.i18n import _ | |
90 | from mercurial import ( |
|
91 | from mercurial import ( | |
91 | context, |
|
92 | context, | |
92 | error, |
|
93 | error, | |
93 | node, |
|
|||
94 | obsolete, |
|
94 | obsolete, | |
95 | pycompat, |
|
95 | pycompat, | |
96 | registrar, |
|
96 | registrar, | |
@@ -299,7 +299,7 b' class simplecommitctx(context.committabl' | |||||
299 | self._added = added |
|
299 | self._added = added | |
300 | self._parents = parentctxs |
|
300 | self._parents = parentctxs | |
301 | while len(self._parents) < 2: |
|
301 | while len(self._parents) < 2: | |
302 |
self._parents.append(repo[ |
|
302 | self._parents.append(repo[nullid]) | |
303 |
|
303 | |||
304 | def filectx(self, key): |
|
304 | def filectx(self, key): | |
305 | return simplefilectx(key, self._added[key]) |
|
305 | return simplefilectx(key, self._added[key]) | |
@@ -388,7 +388,7 b' def debugdrawdag(ui, repo, **opts):' | |||||
388 | content = content.replace(br'\n', b'\n').replace(br'\1', b'\1') |
|
388 | content = content.replace(br'\n', b'\n').replace(br'\1', b'\1') | |
389 | files[name][path] = content |
|
389 | files[name][path] = content | |
390 |
|
390 | |||
391 |
committed = {None: |
|
391 | committed = {None: nullid} # {name: node} | |
392 |
|
392 | |||
393 | # for leaf nodes, try to find existing nodes in repo |
|
393 | # for leaf nodes, try to find existing nodes in repo | |
394 | for name, parents in edges.items(): |
|
394 | for name, parents in edges.items(): |
@@ -12,11 +12,12 b' import sys' | |||||
12 | import unittest |
|
12 | import unittest | |
13 |
|
13 | |||
14 | from mercurial.node import ( |
|
14 | from mercurial.node import ( | |
|
15 | bin, | |||
|
16 | hex, | |||
15 | nullid, |
|
17 | nullid, | |
16 | nullrev, |
|
18 | nullrev, | |
17 | ) |
|
19 | ) | |
18 | from mercurial import ( |
|
20 | from mercurial import ( | |
19 | node as nodemod, |
|
|||
20 | policy, |
|
21 | policy, | |
21 | pycompat, |
|
22 | pycompat, | |
22 | ) |
|
23 | ) | |
@@ -232,7 +233,7 b' class parseindex2tests(unittest.TestCase' | |||||
232 | self.assertEqual( |
|
233 | self.assertEqual( | |
233 | ix[r[7]], |
|
234 | ix[r[7]], | |
234 | i, |
|
235 | i, | |
235 |
'Reverse lookup inconsistent for %r' % |
|
236 | 'Reverse lookup inconsistent for %r' % hex(r[7]), | |
236 | ) |
|
237 | ) | |
237 | except TypeError: |
|
238 | except TypeError: | |
238 | # pure version doesn't support this |
|
239 | # pure version doesn't support this | |
@@ -255,7 +256,7 b' class parseindex2tests(unittest.TestCase' | |||||
255 | if rev == nullrev: |
|
256 | if rev == nullrev: | |
256 | return b'\xff\xff\xff\xff' |
|
257 | return b'\xff\xff\xff\xff' | |
257 | else: |
|
258 | else: | |
258 |
return |
|
259 | return bin('%08x' % rev) | |
259 |
|
260 | |||
260 | def appendrev(p1, p2=nullrev): |
|
261 | def appendrev(p1, p2=nullrev): | |
261 | # node won't matter for this test, let's just make sure |
|
262 | # node won't matter for this test, let's just make sure |
@@ -6,9 +6,9 b' import collections' | |||||
6 | import hashlib |
|
6 | import hashlib | |
7 | import sys |
|
7 | import sys | |
8 |
|
8 | |||
|
9 | from mercurial.node import nullid | |||
9 | from mercurial import ( |
|
10 | from mercurial import ( | |
10 | encoding, |
|
11 | encoding, | |
11 | node, |
|
|||
12 | revlog, |
|
12 | revlog, | |
13 | transaction, |
|
13 | transaction, | |
14 | vfs, |
|
14 | vfs, | |
@@ -93,7 +93,7 b' def appendrev(rlog, text, tr, isext=Fals' | |||||
93 | """ |
|
93 | """ | |
94 | nextrev = len(rlog) |
|
94 | nextrev = len(rlog) | |
95 | p1 = rlog.node(nextrev - 1) |
|
95 | p1 = rlog.node(nextrev - 1) | |
96 |
p2 = |
|
96 | p2 = nullid | |
97 | if isext: |
|
97 | if isext: | |
98 | flags = revlog.REVIDX_EXTSTORED |
|
98 | flags = revlog.REVIDX_EXTSTORED | |
99 | else: |
|
99 | else: | |
@@ -127,7 +127,7 b" def addgroupcopy(rlog, tr, destname=b'_d" | |||||
127 | class dummychangegroup(object): |
|
127 | class dummychangegroup(object): | |
128 | @staticmethod |
|
128 | @staticmethod | |
129 | def deltachunk(pnode): |
|
129 | def deltachunk(pnode): | |
130 |
pnode = pnode or |
|
130 | pnode = pnode or nullid | |
131 | parentrev = rlog.rev(pnode) |
|
131 | parentrev = rlog.rev(pnode) | |
132 | r = parentrev + 1 |
|
132 | r = parentrev + 1 | |
133 | if r >= len(rlog): |
|
133 | if r >= len(rlog): | |
@@ -142,7 +142,7 b" def addgroupcopy(rlog, tr, destname=b'_d" | |||||
142 | return { |
|
142 | return { | |
143 | b'node': rlog.node(r), |
|
143 | b'node': rlog.node(r), | |
144 | b'p1': pnode, |
|
144 | b'p1': pnode, | |
145 |
b'p2': |
|
145 | b'p2': nullid, | |
146 | b'cs': rlog.node(rlog.linkrev(r)), |
|
146 | b'cs': rlog.node(rlog.linkrev(r)), | |
147 | b'flags': rlog.flags(r), |
|
147 | b'flags': rlog.flags(r), | |
148 | b'deltabase': rlog.node(deltaparent), |
|
148 | b'deltabase': rlog.node(deltaparent), | |
@@ -181,7 +181,7 b" def lowlevelcopy(rlog, tr, destname=b'_d" | |||||
181 | dlog = newrevlog(destname, recreate=True) |
|
181 | dlog = newrevlog(destname, recreate=True) | |
182 | for r in rlog: |
|
182 | for r in rlog: | |
183 | p1 = rlog.node(r - 1) |
|
183 | p1 = rlog.node(r - 1) | |
184 |
p2 = |
|
184 | p2 = nullid | |
185 | if r == 0 or (rlog.flags(r) & revlog.REVIDX_EXTSTORED): |
|
185 | if r == 0 or (rlog.flags(r) & revlog.REVIDX_EXTSTORED): | |
186 | text = rlog.rawdata(r) |
|
186 | text = rlog.rawdata(r) | |
187 | cachedelta = None |
|
187 | cachedelta = None |
@@ -2,10 +2,8 b' from __future__ import absolute_import' | |||||
2 | import sys |
|
2 | import sys | |
3 | import unittest |
|
3 | import unittest | |
4 |
|
4 | |||
5 |
from mercurial import |
|
5 | from mercurial.node import wdirrev | |
6 | error, |
|
6 | from mercurial import error | |
7 | node, |
|
|||
8 | ) |
|
|||
9 |
|
7 | |||
10 | from mercurial.testing import revlog as revlogtesting |
|
8 | from mercurial.testing import revlog as revlogtesting | |
11 |
|
9 | |||
@@ -150,7 +148,7 b' class rustancestorstest(revlogtesting.Re' | |||||
150 | # WdirUnsupported directly |
|
148 | # WdirUnsupported directly | |
151 | idx = self.parseindex() |
|
149 | idx = self.parseindex() | |
152 | with self.assertRaises(error.WdirUnsupported): |
|
150 | with self.assertRaises(error.WdirUnsupported): | |
153 |
list(AncestorsIterator(idx, [ |
|
151 | list(AncestorsIterator(idx, [wdirrev], -1, False)) | |
154 |
|
152 | |||
155 | def testheadrevs(self): |
|
153 | def testheadrevs(self): | |
156 | idx = self.parseindex() |
|
154 | idx = self.parseindex() |
@@ -10,9 +10,12 b' from __future__ import absolute_import' | |||||
10 | import hashlib |
|
10 | import hashlib | |
11 | import struct |
|
11 | import struct | |
12 |
|
12 | |||
|
13 | from mercurial.node import ( | |||
|
14 | nullid, | |||
|
15 | nullrev, | |||
|
16 | ) | |||
13 | from mercurial import ( |
|
17 | from mercurial import ( | |
14 | extensions, |
|
18 | extensions, | |
15 | node, |
|
|||
16 | requirements, |
|
19 | requirements, | |
17 | revlog, |
|
20 | revlog, | |
18 | ) |
|
21 | ) | |
@@ -41,7 +44,7 b' def wraprevision(orig, self, nodeorrev, ' | |||||
41 | text = orig(self, nodeorrev, *args, **kwargs) |
|
44 | text = orig(self, nodeorrev, *args, **kwargs) | |
42 | if getattr(self, 'sidedatanocheck', False): |
|
45 | if getattr(self, 'sidedatanocheck', False): | |
43 | return text |
|
46 | return text | |
44 |
if nodeorrev != |
|
47 | if nodeorrev != nullrev and nodeorrev != nullid: | |
45 | sd = self.sidedata(nodeorrev) |
|
48 | sd = self.sidedata(nodeorrev) | |
46 | if len(text) != struct.unpack('>I', sd[sidedata.SD_TEST1])[0]: |
|
49 | if len(text) != struct.unpack('>I', sd[sidedata.SD_TEST1])[0]: | |
47 | raise RuntimeError('text size mismatch') |
|
50 | raise RuntimeError('text size mismatch') |
General Comments 0
You need to be logged in to leave comments.
Login now