changeset 41667:8fa1a5fb8a28

largefiles: get cwd and relative paths from repo instead of matcher As far as I can tell, the matcher returned from matchandpats() got its cwd from the context object, which in turn got it from the repo, so this should be equivalent. Differential Revision: https://phab.mercurial-scm.org/D5922
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 09 Feb 2019 16:43:20 -0800
parents a950b65cbe1b
children c4f023b656cf
files hgext/largefiles/overrides.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Sat Feb 09 14:37:58 2019 -0800
+++ b/hgext/largefiles/overrides.py	Sat Feb 09 16:43:20 2019 -0800
@@ -301,9 +301,10 @@
                 return kindpat[0] + ':' + tostandin(kindpat[1])
             return tostandin(kindpat[1])
 
-        if m._cwd:
+        cwd = repo.getcwd()
+        if cwd:
             hglf = lfutil.shortname
-            back = util.pconvert(m.rel(hglf)[:-len(hglf)])
+            back = util.pconvert(repo.pathto(hglf)[:-len(hglf)])
 
             def tostandin(f):
                 # The file may already be a standin, so truncate the back
@@ -316,10 +317,10 @@
                 # path to the root before building the standin.  Otherwise cwd
                 # is somewhere in the repo, relative to root, and needs to be
                 # prepended before building the standin.
-                if os.path.isabs(m._cwd):
+                if os.path.isabs(cwd):
                     f = f[len(back):]
                 else:
-                    f = m._cwd + '/' + f
+                    f = cwd + '/' + f
                 return back + lfutil.standin(f)
         else:
             def tostandin(f):