# HG changeset patch # User Matt Mackall # Date 2014-08-14 21:25:47 # Node ID d3702a822241095384d565b2e0b22614f8eeefc7 # Parent 3ddfb9b3fdc65e16b36c843673109ae34f33ac5a # Parent 989c16c1b050a314e136675ca9ac73a90d13da2a merge with stable diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -267,6 +267,11 @@ def overridelog(orig, ui, repo, *pats, * matchandpats = oldmatchandpats(ctx, pats, opts, globbed, default) m, p = copy.copy(matchandpats) + if m.always(): + # We want to match everything anyway, so there's no benefit trying + # to add standins. + return matchandpats + pats = set(p) # TODO: handling of patterns in both cases below if m._cwd: @@ -299,13 +304,25 @@ def overridelog(orig, ui, repo, *pats, * return m, pats + # For hg log --patch, the match object is used in two different senses: + # (1) to determine what revisions should be printed out, and + # (2) to determine what files to print out diffs for. + # The magic matchandpats override should be used for case (1) but not for + # case (2). + def overridemakelogfilematcher(repo, pats, opts): + pctx = repo[None] + match, pats = oldmatchandpats(pctx, pats, opts) + return lambda rev: match + oldmatchandpats = installmatchandpatsfn(overridematchandpats) + oldmakelogfilematcher = cmdutil._makenofollowlogfilematcher + setattr(cmdutil, '_makenofollowlogfilematcher', overridemakelogfilematcher) + try: - repo.lfstatus = True return orig(ui, repo, *pats, **opts) finally: - repo.lfstatus = False restorematchandpatsfn() + setattr(cmdutil, '_makenofollowlogfilematcher', oldmakelogfilematcher) def overrideverify(orig, ui, repo, *pats, **opts): large = opts.pop('large', False) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1500,7 +1500,7 @@ def walkchangerevs(repo, match, opts, pr return iterate() -def _makelogfilematcher(repo, files, followfirst): +def _makefollowlogfilematcher(repo, files, followfirst): # When displaying a revision with --patch --follow FILE, we have # to know which file of the revision must be diffed. With # --follow, we want the names of the ancestors of FILE in the @@ -1527,6 +1527,10 @@ def _makelogfilematcher(repo, files, fol return filematcher +def _makenofollowlogfilematcher(repo, pats, opts): + '''hook for extensions to override the filematcher for non-follow cases''' + return None + def _makelogrevset(repo, pats, opts, revs): """Return (expr, filematcher) where expr is a revset string built from log options and file patterns or None. If --stat or --patch @@ -1646,9 +1650,12 @@ def _makelogrevset(repo, pats, opts, rev if follow and not match.always() and not slowpath: # _makelogfilematcher expects its files argument to be relative to # the repo root, so use match.files(), not pats. - filematcher = _makelogfilematcher(repo, match.files(), followfirst) + filematcher = _makefollowlogfilematcher(repo, match.files(), + followfirst) else: - filematcher = lambda rev: match + filematcher = _makenofollowlogfilematcher(repo, pats, opts) + if filematcher is None: + filematcher = lambda rev: match expr = [] for op, val in opts.iteritems(): diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -724,6 +724,197 @@ Test graph log | o 0:30d30fe6a5be add files + +Test log with --patch + + $ hg log --patch -r 6::7 + changeset: 6:4355d653f84f + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: edit files yet again + + diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3 + --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -baaf12afde9d8d67f25dab6dced0d2bf77dba47c + +7838695e10da2bb75ac1156565f40a2595fa2fa0 + diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 + --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -aeb2210d19f02886dde00dac279729a48471e2f9 + +971fb41e78fea4f8e0ba5244784239371cb00591 + diff -r 9d5af5072dbd -r 4355d653f84f normal3 + --- a/normal3 Thu Jan 01 00:00:00 1970 +0000 + +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -normal3 + +normal33 + diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4 + --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 + +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -normal4 + +normal44 + + changeset: 7:daea875e9014 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add/edit more largefiles + + diff -r 4355d653f84f -r daea875e9014 .hglf/large3 + --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 + +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +0,0 @@ + -7838695e10da2bb75ac1156565f40a2595fa2fa0 + diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6 + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 + diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7 + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +bb3151689acb10f0c3125c560d5e63df914bc1af + + + $ hg log --patch -r 6::7 sub/ + changeset: 6:4355d653f84f + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: edit files yet again + + diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 + --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -aeb2210d19f02886dde00dac279729a48471e2f9 + +971fb41e78fea4f8e0ba5244784239371cb00591 + diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4 + --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 + +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -normal4 + +normal44 + + +log with both --follow and --patch + + $ hg log --follow --patch --limit 2 + changeset: 7:daea875e9014 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add/edit more largefiles + + diff -r 4355d653f84f -r daea875e9014 .hglf/large3 + --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 + +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +0,0 @@ + -7838695e10da2bb75ac1156565f40a2595fa2fa0 + diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large6 + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub2/large6 Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +0d6d75887db61b2c7e6c74b5dd8fc6ad50c0cc30 + diff -r 4355d653f84f -r daea875e9014 .hglf/sub2/large7 + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub2/large7 Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +bb3151689acb10f0c3125c560d5e63df914bc1af + + changeset: 6:4355d653f84f + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: edit files yet again + + diff -r 9d5af5072dbd -r 4355d653f84f .hglf/large3 + --- a/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/large3 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -baaf12afde9d8d67f25dab6dced0d2bf77dba47c + +7838695e10da2bb75ac1156565f40a2595fa2fa0 + diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 + --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -aeb2210d19f02886dde00dac279729a48471e2f9 + +971fb41e78fea4f8e0ba5244784239371cb00591 + diff -r 9d5af5072dbd -r 4355d653f84f normal3 + --- a/normal3 Thu Jan 01 00:00:00 1970 +0000 + +++ b/normal3 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -normal3 + +normal33 + diff -r 9d5af5072dbd -r 4355d653f84f sub/normal4 + --- a/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 + +++ b/sub/normal4 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -normal4 + +normal44 + + $ hg log --follow --patch sub/large4 + changeset: 6:4355d653f84f + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: edit files yet again + + diff -r 9d5af5072dbd -r 4355d653f84f .hglf/sub/large4 + --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -aeb2210d19f02886dde00dac279729a48471e2f9 + +971fb41e78fea4f8e0ba5244784239371cb00591 + + changeset: 5:9d5af5072dbd + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: edit files again + + diff -r 74c02385b94c -r 9d5af5072dbd .hglf/sub/large4 + --- a/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 + +aeb2210d19f02886dde00dac279729a48471e2f9 + + changeset: 4:74c02385b94c + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: move files + + diff -r 9e8fbc4bce62 -r 74c02385b94c .hglf/sub/large4 + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub/large4 Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 + + changeset: 1:ce8896473775 + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: edit files + + diff -r 30d30fe6a5be -r ce8896473775 .hglf/sub/large2 + --- a/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,1 @@ + -1deebade43c8c498a3c8daddac0244dc55d1331d + +eb7338044dc27f9bc59b8dd5a246b065ead7a9c4 + + changeset: 0:30d30fe6a5be + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: add files + + diff -r 000000000000 -r 30d30fe6a5be .hglf/sub/large2 + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/.hglf/sub/large2 Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +1deebade43c8c498a3c8daddac0244dc55d1331d + $ cat sub/normal4 normal44 $ cat sub/large4 diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -33,8 +33,8 @@ failing test $ $TESTDIR/run-tests.py --with-hg=`which hg` - --- $TESTTMP/test-failure.t - +++ $TESTTMP/test-failure.t.err + --- $TESTTMP/test-failure.t (glob) + +++ $TESTTMP/test-failure.t.err (glob) @@ -1,4 +1,4 @@ $ echo babar - rataxes @@ -87,8 +87,8 @@ test for --retest $ $TESTDIR/run-tests.py --with-hg=`which hg` --retest - --- $TESTTMP/test-failure.t - +++ $TESTTMP/test-failure.t.err + --- $TESTTMP/test-failure.t (glob) + +++ $TESTTMP/test-failure.t.err (glob) @@ -1,4 +1,4 @@ $ echo babar - rataxes @@ -121,8 +121,8 @@ failed $ $TESTDIR/run-tests.py --with-hg=`which hg` test-failure.t - --- $TESTTMP/test-failure.t - +++ $TESTTMP/test-failure.t.err + --- $TESTTMP/test-failure.t (glob) + +++ $TESTTMP/test-failure.t.err (glob) @@ -1,4 +1,4 @@ $ echo babar - rataxes