Mercurial > public > mercurial-scm > hg-stable
diff hgext/largefiles/overrides.py @ 24208:e6b0de02a02e
largefiles: handle logging from outside the repo
It's probably possible to refactor so that the 'if m._cwd' check isn't
necessary, but the False case is the typical case (i.e. run from the root of the
repo), and simpler to read.
An exact path to a largefile from outside the repo was previously ignored.
match.rel('.hglf') will handle figuring out both the correct '../' length to the
standin directory if inside the repo, or path/to/repo from outside, at the cost
of a pconvert() to keep the patterns using '/' on Windows.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 01 Mar 2015 18:35:29 -0500 |
parents | d90e3faf96a9 |
children | 23438bceba04 |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Sun Mar 01 14:21:54 2015 -0500 +++ b/hgext/largefiles/overrides.py Sun Mar 01 18:35:29 2015 -0500 @@ -313,19 +313,25 @@ return tostandin(kindpat[1]) if m._cwd: - if os.path.isabs(m._cwd): - # TODO: handle largefile magic when invoked from other cwd - return matchandpats - back = (m._cwd.count('/') + 1) * '../' + hglf = lfutil.shortname + back = util.pconvert(m.rel(hglf)[:-len(hglf)]) def tostandin(f): # The file may already be a standin, so trucate the back - # escaping and test before mangling it. This avoids turning + # prefix and test before mangling it. This avoids turning # 'glob:../.hglf/foo*' into 'glob:../.hglf/../.hglf/foo*'. if f.startswith(back) and lfutil.splitstandin(f[len(back):]): return f - return back + lfutil.standin(m._cwd + '/' + f) + # An absolute path is from outside the repo, so truncate the + # 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): + f = f[len(back):] + else: + f = m._cwd + '/' + f + return back + lfutil.standin(f) pats.update(fixpats(f, tostandin) for f in p) else: