equal
deleted
inserted
replaced
34 from __future__ import absolute_import |
34 from __future__ import absolute_import |
35 |
35 |
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, |
42 context, |
47 context, |
43 crecord, |
48 crecord, |
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, |
51 pycompat, |
55 pycompat, |
52 registrar, |
56 registrar, |
100 |
104 |
101 def data(self): |
105 def data(self): |
102 return b'' |
106 return b'' |
103 |
107 |
104 def node(self): |
108 def node(self): |
105 return node.nullid |
109 return nullid |
106 |
110 |
107 |
111 |
108 def uniq(lst): |
112 def uniq(lst): |
109 """list -> list. remove duplicated items without changing the order""" |
113 """list -> list. remove duplicated items without changing the order""" |
110 seen = set() |
114 seen = set() |
365 blines = self.targetlines[b1:b2] |
369 blines = self.targetlines[b1:b2] |
366 if self.ui.debugflag: |
370 if self.ui.debugflag: |
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 % (node.short(self.fctxs[idx].node()), a1, a2, len(blines)) |
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): |
374 self.finalcontents = self._checkoutlinelogwithedits() |
378 self.finalcontents = self._checkoutlinelogwithedits() |
375 else: |
379 else: |
484 ] |
488 ] |
485 for i, (j, f) in enumerate(visiblefctxs): |
489 for i, (j, f) in enumerate(visiblefctxs): |
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 node.short(f.node()), |
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)) |
493 # figure out the lifetime of a line, this is relatively inefficient, |
497 # figure out the lifetime of a line, this is relatively inefficient, |
494 # but probably fine |
498 # but probably fine |
814 |
818 |
815 def _ctx2str(self, ctx): |
819 def _ctx2str(self, ctx): |
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(), node.short(ctx.node())) |
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} |
823 |
827 |
824 fetch file contents from filefixupstates. |
828 fetch file contents from filefixupstates. |
847 for name, hsh in needupdate: |
851 for name, hsh in needupdate: |
848 if hsh: |
852 if hsh: |
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, node.hex(hsh)) |
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)) |
856 if self.ui.verbose: |
860 if self.ui.verbose: |
857 self.ui.write(_(b'deleting bookmark %s\n') % name) |
861 self.ui.write(_(b'deleting bookmark %s\n') % name) |
918 """(ctx, {path: content}, node) -> node. make a single commit |
922 """(ctx, {path: content}, node) -> node. make a single commit |
919 |
923 |
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, node.nullid) |
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() |
927 |
931 |
928 desc = rewriteutil.update_hash_refs( |
932 desc = rewriteutil.update_hash_refs( |