D6158: memctx: rename constructor argument "copied" to "copysource" (API)

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Mar 20 06:16:33 UTC 2019


martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It's just the path, not the nodeid, so "copysource" seems more
  appropriate.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/fix.py
  hgext/histedit.py
  hgext/uncommit.py
  mercurial/cmdutil.py
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2233,10 +2233,10 @@
     """
     def getfilectx(repo, memctx, path):
         fctx = ctx[path]
-        copied = fctx.copysource()
+        copysource = fctx.copysource()
         return memfilectx(repo, memctx, path, fctx.data(),
                           islink=fctx.islink(), isexec=fctx.isexec(),
-                          copied=copied)
+                          copysource=copysource)
 
     return getfilectx
 
@@ -2246,12 +2246,12 @@
     This is a convenience method for building a memctx based on a patchstore.
     """
     def getfilectx(repo, memctx, path):
-        data, mode, copied = patchstore.getfile(path)
+        data, mode, copysource = patchstore.getfile(path)
         if data is None:
             return None
         islink, isexec = mode
         return memfilectx(repo, memctx, path, data, islink=islink,
-                          isexec=isexec, copied=copied)
+                          isexec=isexec, copysource=copysource)
 
     return getfilectx
 
@@ -2377,7 +2377,7 @@
     See memctx and committablefilectx for more details.
     """
     def __init__(self, repo, changectx, path, data, islink=False,
-                 isexec=False, copied=None):
+                 isexec=False, copysource=None):
         """
         path is the normalized file path relative to repository root.
         data is the file content as a string.
@@ -2394,8 +2394,8 @@
         else:
             self._flags = ''
         self._copied = None
-        if copied:
-            self._copied = (copied, nullid)
+        if copysource:
+            self._copied = (copysource, nullid)
 
     def cmp(self, fctx):
         return self.data() != fctx.data()
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2563,7 +2563,7 @@
                                               fctx.path(), fctx.data(),
                                               islink='l' in flags,
                                               isexec='x' in flags,
-                                              copied=copied.get(path))
+                                              copysource=copied.get(path))
                     return mctx
                 except KeyError:
                     return None
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -83,7 +83,7 @@
         mctx = context.memfilectx(repo, memctx, fctx.path(), fctx.data(),
                                   fctx.islink(),
                                   fctx.isexec(),
-                                  copied=copied.get(path))
+                                  copysource=copied.get(path))
         return mctx
 
     if not files:
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -645,7 +645,7 @@
                                       fctx.path(), fctx.data(),
                                       islink='l' in flags,
                                       isexec='x' in flags,
-                                      copied=copied.get(path))
+                                      copysource=copied.get(path))
             return mctx
         return None
 
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -601,15 +601,15 @@
         if path not in ctx:
             return None
         fctx = ctx[path]
-        copied = fctx.copysource()
+        copysource = fctx.copysource()
         return context.memfilectx(
             repo,
             memctx,
             path=fctx.path(),
             data=filedata.get(path, fctx.data()),
             islink=fctx.islink(),
             isexec=fctx.isexec(),
-            copied=copied)
+            copysource=copysource)
 
     extra = ctx.extra().copy()
     extra['fix_source'] = ctx.hex()



To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list