diff mercurial/filelog.py @ 40006:1d97a332c6d9

storageutil: extract copy metadata retrieval out of filelog As part of implementing an alternate storage backend, I found myself reinventing this wheel. Let's create a utility function for doing the work. Differential Revision: https://phab.mercurial-scm.org/D4800
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 28 Sep 2018 11:37:49 -0700
parents 0e8836be9541
children 422beffd71ba
line wrap: on
line diff
--- a/mercurial/filelog.py	Fri Sep 28 11:29:05 2018 -0700
+++ b/mercurial/filelog.py	Fri Sep 28 11:37:49 2018 -0700
@@ -115,15 +115,7 @@
         return self.addrevision(text, transaction, link, p1, p2)
 
     def renamed(self, node):
-        if self.parents(node)[0] != revlog.nullid:
-            return False
-        t = self.revision(node)
-        m = storageutil.parsemeta(t)[0]
-        # copy and copyrev occur in pairs. In rare cases due to bugs,
-        # one can occur without the other.
-        if m and "copy" in m and "copyrev" in m:
-            return (m["copy"], revlog.bin(m["copyrev"]))
-        return False
+        return storageutil.filerevisioncopied(self, node)
 
     def size(self, rev):
         """return the size of a given revision"""