##// END OF EJS Templates
commitctx: directly pass a ChangingFiles object to changelog.add...
marmoute -
r45884:6c562773 default
parent child Browse files
Show More
@@ -524,10 +524,6 b' class changelog(revlog.revlog):'
524 524 user,
525 525 date=None,
526 526 extra=None,
527 p1copies=None,
528 p2copies=None,
529 filesadded=None,
530 filesremoved=None,
531 527 ):
532 528 # Convert to UTF-8 encoded bytestrings as the very first
533 529 # thing: calling any method on a localstr object will turn it
@@ -559,19 +555,23 b' class changelog(revlog.revlog):'
559 555 raise error.StorageError(
560 556 _(b'the name \'%s\' is reserved') % branch
561 557 )
562 sortedfiles = sorted(files)
558 sortedfiles = sorted(files.touched)
563 559 sidedata = None
564 560 if self._copiesstorage == b'changeset-sidedata':
565 561 sidedata = {}
562 p1copies = files.copied_from_p1
566 563 if p1copies:
567 564 p1copies = metadata.encodecopies(sortedfiles, p1copies)
568 565 sidedata[sidedatamod.SD_P1COPIES] = p1copies
566 p2copies = files.copied_from_p2
569 567 if p2copies:
570 568 p2copies = metadata.encodecopies(sortedfiles, p2copies)
571 569 sidedata[sidedatamod.SD_P2COPIES] = p2copies
570 filesadded = files.added
572 571 if filesadded:
573 572 filesadded = metadata.encodefileindices(sortedfiles, filesadded)
574 573 sidedata[sidedatamod.SD_FILESADDED] = filesadded
574 filesremoved = files.removed
575 575 if filesremoved:
576 576 filesremoved = metadata.encodefileindices(
577 577 sortedfiles, filesremoved
@@ -84,7 +84,7 b' def commitctx(repo, ctx, error=False, or'
84 84 repo.changelog.delayupdate(tr)
85 85 n = repo.changelog.add(
86 86 mn,
87 files.touched,
87 files,
88 88 ctx.description(),
89 89 tr,
90 90 p1.node(),
@@ -92,10 +92,6 b' def commitctx(repo, ctx, error=False, or'
92 92 user,
93 93 ctx.date(),
94 94 extra,
95 files.copied_from_p1,
96 files.copied_from_p2,
97 files.added,
98 files.removed,
99 95 )
100 96 xp1, xp2 = p1.hex(), p2 and p2.hex() or b''
101 97 repo.hook(
@@ -8,9 +8,10 b' versions.'
8 8 > convert =
9 9 > EOF
10 10 $ cat <<'EOF' > changefileslist.py
11 > from mercurial import (changelog, extensions)
11 > from mercurial import (changelog, extensions, metadata)
12 12 > def wrap(orig, clog, manifest, files, *args, **kwargs):
13 > return orig(clog, manifest, [b"a"], *args, **kwargs)
13 > files = metadata.ChangingFiles(touched=[b"a"])
14 > return orig(clog, manifest, files, *args, **kwargs)
14 15 > def extsetup(ui):
15 16 > extensions.wrapfunction(changelog.changelog, 'add', wrap)
16 17 > EOF
General Comments 0
You need to be logged in to leave comments. Login now