diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -313,19 +313,25 @@ def overridelog(orig, ui, repo, *pats, * 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: diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t --- a/tests/test-largefiles-misc.t +++ b/tests/test-largefiles-misc.t @@ -451,6 +451,10 @@ Test actions on largefiles using relativ date: Thu Jan 01 00:00:00 1970 +0000 summary: anotherlarge + $ hg --debug log -T '{rev}: {desc}\n' ../sub/anotherlarge + updated patterns: ['../.hglf/sub/../sub/anotherlarge', '../sub/anotherlarge'] + 1: anotherlarge + $ hg log -G anotherlarge @ changeset: 1:9627a577c5e9 | tag: tip @@ -510,6 +514,15 @@ Test glob logging from the root dir $ cd .. +Log from outer space + $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/sub/anotherlarge' + updated patterns: ['addrm2/.hglf/sub/anotherlarge', 'addrm2/sub/anotherlarge'] + 1: anotherlarge + $ hg --debug log -R addrm2 -T '{rev}: {desc}\n' 'addrm2/.hglf/sub/anotherlarge' + updated patterns: ['addrm2/.hglf/sub/anotherlarge'] + 1: anotherlarge + + Check error message while exchange =========================================================