Patchwork D7072: sidedatacopies: directly fetch copies information from sidedata

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2019, 5:02 p.m.
Message ID <0afff7ea9cf829d6deb2ec0dc6a4e326@localhost.localdomain>
Download mbox | patch
Permalink /patch/42412/
State Not Applicable
Headers show

Comments

phabricator - Oct. 16, 2019, 5:02 p.m.
marmoute updated this revision to Diff 17246.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7072?vs=17112&id=17246

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7072/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7072

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -190,12 +190,25 @@ 
     cl = repo.changelog
     parents = cl.parentrevs
 
-    def revinfo(rev):
-        p1, p2 = parents(rev)
-        ctx = repo[rev]
-        p1copies, p2copies = ctx._copies
-        removed = ctx.filesremoved()
-        return p1, p2, p1copies, p2copies, removed
+    if repo.filecopiesmode == b'changeset-sidedata':
+        changelogrevision = cl.changelogrevision
+
+        def revinfo(rev):
+            p1, p2 = parents(rev)
+            c = changelogrevision(rev)
+            p1copies = c.p1copies
+            p2copies = c.p2copies
+            removed = c.filesremoved
+            return p1, p2, p1copies, p2copies, removed
+
+    else:
+
+        def revinfo(rev):
+            p1, p2 = parents(rev)
+            ctx = repo[rev]
+            p1copies, p2copies = ctx._copies
+            removed = ctx.filesremoved()
+            return p1, p2, p1copies, p2copies, removed
 
     return revinfo