diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -362,23 +362,43 @@ @property def filesadded(self): - rawindices = self.extra.get(b'filesadded') - return rawindices and decodefileindices(self.files, rawindices) + if sidedatamod.SD_FILESADDED in self._sidedata: + rawindices = self._sidedata.get(sidedatamod.SD_FILESADDED) + else: + rawindices = self.extra.get(b'filesadded') + if rawindices is not None: + rawindices = decodefileindices(self.files, rawindices) + return rawindices @property def filesremoved(self): - rawindices = self.extra.get(b'filesremoved') - return rawindices and decodefileindices(self.files, rawindices) + if sidedatamod.SD_FILESREMOVED in self._sidedata: + rawindices = self._sidedata.get(sidedatamod.SD_FILESREMOVED) + else: + rawindices = self.extra.get(b'filesremoved') + if rawindices is not None: + rawindices = decodefileindices(self.files, rawindices) + return rawindices @property def p1copies(self): - rawcopies = self.extra.get(b'p1copies') - return rawcopies and decodecopies(self.files, rawcopies) + if sidedatamod.SD_P1COPIES in self._sidedata: + rawcopies = self._sidedata.get(sidedatamod.SD_P1COPIES) + else: + rawcopies = self.extra.get(b'p1copies') + if rawcopies is not None: + rawcopies = decodecopies(self.files, rawcopies) + return rawcopies @property def p2copies(self): - rawcopies = self.extra.get(b'p2copies') - return rawcopies and decodecopies(self.files, rawcopies) + if sidedatamod.SD_P2COPIES in self._sidedata: + rawcopies = self._sidedata.get(sidedatamod.SD_P2COPIES) + else: + rawcopies = self.extra.get(b'p2copies') + if rawcopies is not None: + rawcopies = decodecopies(self.files, rawcopies) + return rawcopies @property def description(self): diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -534,7 +534,10 @@ def filesadded(self): filesadded = self._changeset.filesadded - if True: + if self._repo.filecopiesmode == b'changeset-sidedata': + if filesadded is None: + filesadded = [] + else: source = self._repo.ui.config(b'experimental', b'copies.read-from') if source == b'changeset-only': if filesadded is None: @@ -548,7 +551,10 @@ def filesremoved(self): filesremoved = self._changeset.filesremoved - if True: + if self._repo.filecopiesmode == b'changeset-sidedata': + if filesremoved is None: + filesremoved = [] + else: source = self._repo.ui.config(b'experimental', b'copies.read-from') if source == b'changeset-only': if filesremoved is None: @@ -564,7 +570,12 @@ def _copies(self): p1copies = self._changeset.p1copies p2copies = self._changeset.p2copies - if True: + if self._repo.filecopiesmode == b'changeset-sidedata': + if p1copies is None: + p1copies = {} + if p2copies is None: + p2copies = {} + else: source = self._repo.ui.config(b'experimental', b'copies.read-from') # If config says to get copy metadata only from changeset, then # return that, defaulting to {} if there was no copy metadata. In diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -187,6 +187,8 @@ def usechangesetcentricalgo(repo): """Checks if we should use changeset-centric copy algorithms""" + if repo.filecopiesmode == b'changeset-sidedata': + return True readfrom = repo.ui.config(b'experimental', b'copies.read-from') changesetsource = (b'changeset-only', b'compatibility') return readfrom in changesetsource diff --git a/tests/test-copies-unrelated.t b/tests/test-copies-unrelated.t --- a/tests/test-copies-unrelated.t +++ b/tests/test-copies-unrelated.t @@ -179,8 +179,8 @@ o 0 add x x $ hg debugpathcopies 0 5 - x -> y (no-filelog no-sidedata !) -#if no-filelog no-sidedata + x -> y (no-filelog !) +#if no-filelog $ hg graft -r 2 grafting 2:* "modify x again" (glob) merging y and x to y @@ -347,8 +347,8 @@ o 0 base a $ hg debugpathcopies 1 5 - x -> y (no-filelog no-sidedata !) -#if no-filelog no-sidedata + x -> y (no-filelog !) +#if no-filelog $ hg graft -r 2 grafting 2:* "modify x" (glob) merging y and x to y diff --git a/tests/test-copies.t b/tests/test-copies.t --- a/tests/test-copies.t +++ b/tests/test-copies.t @@ -309,7 +309,6 @@ x -> z $ hg debugpathcopies 0 2 x -> z (filelog !) - x -> z (sidedata !) Copy file that exists on both sides of the merge, different content $ newrepo @@ -338,12 +337,14 @@ x $ hg debugp1copies -r 2 x -> z (changeset !) + x -> z (sidedata !) $ hg debugp2copies -r 2 - x -> z (no-changeset !) + x -> z (no-changeset no-sidedata !) $ hg debugpathcopies 1 2 x -> z (changeset !) + x -> z (sidedata !) $ hg debugpathcopies 0 2 - x -> z (no-changeset !) + x -> z (no-changeset no-sidedata !) Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent of the merge to the merge should include the copy from the other side. @@ -403,7 +404,7 @@ $ hg debugpathcopies 2 3 y -> z $ hg debugpathcopies 1 3 - y -> z (no-filelog no-sidedata !) + y -> z (no-filelog !) Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the other side. When storing copies in the changeset, we don't @@ -448,18 +449,18 @@ o 0 add x and y x y $ hg debugpathcopies 1 4 - y -> z (no-filelog no-sidedata !) + y -> z (no-filelog !) $ hg debugpathcopies 2 4 - x -> z (no-filelog no-sidedata !) + x -> z (no-filelog !) $ hg debugpathcopies 0 4 x -> z (filelog !) - x -> z (sidedata !) + y -> z (sidedata !) y -> z (compatibility !) y -> z (changeset !) $ hg debugpathcopies 1 5 - y -> z (no-filelog no-sidedata !) + y -> z (no-filelog !) $ hg debugpathcopies 2 5 - x -> z (no-filelog no-sidedata !) + x -> z (no-filelog !) $ hg debugpathcopies 0 5 x -> z