Mercurial > hg
comparison hgext/largefiles/overrides.py @ 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 | f164076427b2 |
children | 0531dff73d0b |
comparison
equal
deleted
inserted
replaced
41666:a950b65cbe1b | 41667:8fa1a5fb8a28 |
---|---|
299 | 299 |
300 if kindpat[0] is not None: | 300 if kindpat[0] is not None: |
301 return kindpat[0] + ':' + tostandin(kindpat[1]) | 301 return kindpat[0] + ':' + tostandin(kindpat[1]) |
302 return tostandin(kindpat[1]) | 302 return tostandin(kindpat[1]) |
303 | 303 |
304 if m._cwd: | 304 cwd = repo.getcwd() |
305 if cwd: | |
305 hglf = lfutil.shortname | 306 hglf = lfutil.shortname |
306 back = util.pconvert(m.rel(hglf)[:-len(hglf)]) | 307 back = util.pconvert(repo.pathto(hglf)[:-len(hglf)]) |
307 | 308 |
308 def tostandin(f): | 309 def tostandin(f): |
309 # The file may already be a standin, so truncate the back | 310 # The file may already be a standin, so truncate the back |
310 # prefix and test before mangling it. This avoids turning | 311 # prefix and test before mangling it. This avoids turning |
311 # 'glob:../.hglf/foo*' into 'glob:../.hglf/../.hglf/foo*'. | 312 # 'glob:../.hglf/foo*' into 'glob:../.hglf/../.hglf/foo*'. |
314 | 315 |
315 # An absolute path is from outside the repo, so truncate the | 316 # An absolute path is from outside the repo, so truncate the |
316 # path to the root before building the standin. Otherwise cwd | 317 # path to the root before building the standin. Otherwise cwd |
317 # is somewhere in the repo, relative to root, and needs to be | 318 # is somewhere in the repo, relative to root, and needs to be |
318 # prepended before building the standin. | 319 # prepended before building the standin. |
319 if os.path.isabs(m._cwd): | 320 if os.path.isabs(cwd): |
320 f = f[len(back):] | 321 f = f[len(back):] |
321 else: | 322 else: |
322 f = m._cwd + '/' + f | 323 f = cwd + '/' + f |
323 return back + lfutil.standin(f) | 324 return back + lfutil.standin(f) |
324 else: | 325 else: |
325 def tostandin(f): | 326 def tostandin(f): |
326 if lfutil.isstandin(f): | 327 if lfutil.isstandin(f): |
327 return f | 328 return f |