Mercurial > hg
changeset 24207:d90e3faf96a9
largefiles: don't prefix standin patterns with '.hglf' when logging
When logging '.hglf/foo', the pattern list was being transformed from
['.hglf/foo'] into ['.hglf/foo', '.hglf/.hglf/foo']. Aside from the
pathological case of somebody getting a directory named '.hglf' created inside
the standing directory, the old code shouldn't have had any bad effects.
(amended by mpm to sort patterns for test stability and not upset check-code)
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 01 Mar 2015 14:21:54 -0500 |
parents | 13c1e66f9653 |
children | e6b0de02a02e |
files | hgext/largefiles/overrides.py tests/test-largefiles-misc.t tests/test-log.t |
diffstat | 3 files changed, 34 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Sat Feb 28 23:42:38 2015 -0500 +++ b/hgext/largefiles/overrides.py Sun Mar 01 14:21:54 2015 -0500 @@ -319,11 +319,21 @@ back = (m._cwd.count('/') + 1) * '../' def tostandin(f): + # The file may already be a standin, so trucate the back + # escaping 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) pats.update(fixpats(f, tostandin) for f in p) else: - pats.update(fixpats(f) for f in p) + def tostandin(f): + if lfutil.splitstandin(f): + return f + return lfutil.standin(f) + pats.update(fixpats(f, tostandin) for f in p) for i in range(0, len(m._files)): # Don't add '.hglf' to m.files, since that is already covered by '.' @@ -351,6 +361,7 @@ return r m.matchfn = lfmatchfn + ui.debug('updated patterns: %s\n' % sorted(pats)) return m, pats # For hg log --patch, the match object is used in two different senses:
--- a/tests/test-largefiles-misc.t Sat Feb 28 23:42:38 2015 -0500 +++ b/tests/test-largefiles-misc.t Sun Mar 01 14:21:54 2015 -0500 @@ -466,14 +466,22 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: anotherlarge - $ hg log -G glob:another* - @ changeset: 1:9627a577c5e9 - | tag: tip - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: anotherlarge + $ hg --debug log -T '{rev}: {desc}\n' -G glob:another* + updated patterns: ['glob:../.hglf/sub/another*', 'glob:another*'] + @ 1: anotherlarge | +#if no-msys + $ hg --debug log -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys + updated patterns: ['glob:../.hglf/sub/another*'] + 1: anotherlarge + + $ hg --debug log -G -T '{rev}: {desc}\n' 'glob:../.hglf/sub/another*' # no-msys + updated patterns: ['glob:../.hglf/sub/another*'] + @ 1: anotherlarge + | +#endif + $ echo more >> anotherlarge $ hg st . M anotherlarge
--- a/tests/test-log.t Sat Feb 28 23:42:38 2015 -0500 +++ b/tests/test-log.t Sun Mar 01 14:21:54 2015 -0500 @@ -46,12 +46,9 @@ $ hg ci -me -d '5 0' Make sure largefiles doesn't interfere with logging a regular file - $ hg log a --config extensions.largefiles= - changeset: 0:9161b9aeaf16 - user: test - date: Thu Jan 01 00:00:01 1970 +0000 - summary: a - + $ hg --debug log a -T '{rev}: {desc}\n' --config extensions.largefiles= + updated patterns: ['.hglf/a', 'a'] + 0: a $ hg log a changeset: 0:9161b9aeaf16 user: test @@ -69,17 +66,11 @@ date: Thu Jan 01 00:00:01 1970 +0000 summary: a - $ hg log glob:a* --config extensions.largefiles= - changeset: 3:2ca5ba701980 - user: test - date: Thu Jan 01 00:00:04 1970 +0000 - summary: d - - changeset: 0:9161b9aeaf16 - user: test - date: Thu Jan 01 00:00:01 1970 +0000 - summary: a - + $ hg --debug log glob:a* -T '{rev}: {desc}\n' --config extensions.largefiles= + updated patterns: ['glob:.hglf/a*', 'glob:a*'] + 3: d + 0: a + log on directory $ hg log dir