# HG changeset patch # User Kevin Bullock # Date 2014-03-31 15:12:07 # Node ID 81d6dc8c3c6390aa8785fc9f2598b8a46b3fcfd7 # Parent 8a6a86c9a5b58ccc020de1ff0429e72dfa5599fc # Parent e259d4c462b563ebcec7751a2e8291313e99bd59 merge with stable This should correct an earlier couple of bad merges (5433856b2558 and 596960a4ad0d, now pruned) that accidentally brought in a change that had been marked obsolete (244ac996a821). diff --git a/hgext/largefiles/__init__.py b/hgext/largefiles/__init__.py --- a/hgext/largefiles/__init__.py +++ b/hgext/largefiles/__init__.py @@ -105,9 +105,10 @@ explicitly do so with the --large flag p command. ''' -from mercurial import commands, localrepo +from mercurial import commands, hg, localrepo import lfcommands +import proto import reposetup import uisetup as uisetupmod @@ -121,6 +122,7 @@ def featuresetup(ui, supported): def uisetup(ui): localrepo.localrepository.featuresetupfuncs.add(featuresetup) + hg.wirepeersetupfuncs.append(proto.wirereposetup) uisetupmod.uisetup(ui) commands.norepo += " lfconvert" diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py +++ b/hgext/largefiles/reposetup.py @@ -16,14 +16,13 @@ from mercurial.i18n import _ from mercurial import localrepo import lfcommands -import proto import lfutil def reposetup(ui, repo): - # wire repositories should be given new wireproto functions but not the - # other largefiles modifications + # wire repositories should be given new wireproto functions + # by "proto.wirereposetup()" via "hg.wirepeersetupfuncs" if not repo.local(): - return proto.wirereposetup(ui, repo) + return class lfilesrepo(repo.__class__): lfstatus = False diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -98,6 +98,9 @@ def openpath(ui, path): else: return url.open(ui, path) +# a list of (ui, repo) functions called for wire peer initialization +wirepeersetupfuncs = [] + def _peerorrepo(ui, path, create=False): """return a repository object for the specified path""" obj = _peerlookup(path).instance(ui, path, create) @@ -106,6 +109,9 @@ def _peerorrepo(ui, path, create=False): hook = getattr(module, 'reposetup', None) if hook: hook(ui, obj) + if not obj.local(): + for f in wirepeersetupfuncs: + f(ui, obj) return obj def repository(ui, path='', create=False): diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -212,6 +212,7 @@ def buildfunc(exp, context): raise error.ParseError(_("filter %s expects one argument") % n) f = context._filters[n] return (runfilter, (args[0][0], args[0][1], f)) + raise error.ParseError(_("unknown function '%s'") % n) def date(context, mapping, args): if not (1 <= len(args) <= 2): diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -1439,6 +1439,12 @@ Behind the scenes, this will throw Value abort: template filter 'datefilter' is not compatible with keyword 'author' [255] +Thrown an error if a template function doesn't exist + + $ hg tip --template '{foo()}\n' + hg: parse error: unknown function 'foo' + [255] + $ cd .. diff --git a/tests/test-commit.t b/tests/test-commit.t --- a/tests/test-commit.t +++ b/tests/test-commit.t @@ -299,7 +299,7 @@ test saving last-message.txt $ echo 'sub = sub' > .hgsub $ hg add .hgsub - $ cat > $TESTDIR/editor.sh < $TESTTMP/editor.sh < echo "==== before editing:" > cat \$1 > echo "====" @@ -307,7 +307,7 @@ test saving last-message.txt > EOF $ rm -f .hg/last-message.txt - $ HGEDITOR="sh $TESTDIR/editor.sh" hg commit -S -q + $ HGEDITOR="sh $TESTTMP/editor.sh" hg commit -S -q ==== before editing: diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t --- a/tests/test-histedit-fold.t +++ b/tests/test-histedit-fold.t @@ -107,7 +107,7 @@ check histedit_source check saving last-message.txt - $ cat > $TESTDIR/abortfolding.py < $TESTTMP/abortfolding.py < from mercurial import util > def abortfolding(ui, repo, hooktype, **kwargs): > ctx = repo[kwargs.get('node')] @@ -117,10 +117,10 @@ check saving last-message.txt > EOF $ cat > .hg/hgrc < [hooks] - > pretxncommit.abortfolding = python:$TESTDIR/abortfolding.py:abortfolding + > pretxncommit.abortfolding = python:$TESTTMP/abortfolding.py:abortfolding > EOF - $ cat > $TESTDIR/editor.sh << EOF + $ cat > $TESTTMP/editor.sh << EOF > echo "==== before editing" > cat \$1 > echo "====" @@ -128,7 +128,7 @@ check saving last-message.txt > EOF $ rm -f .hg/last-message.txt - $ HGEDITOR="sh $TESTDIR/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <&1 < pick 6de59d13424a f > fold 9c277da72c9b d > EOF diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -2287,4 +2287,30 @@ enabling largefiles extension. $ test -d clone-pull-dst [1] +#if serve + +Test largefiles specific peer setup, when largefiles is enabled +locally (issue4109) + + $ hg showconfig extensions | grep largefiles + extensions.largefiles=! + $ mkdir -p $TESTTMP/individualenabling/usercache + + $ hg serve -R enabledlocally -d -p $HGPORT --pid-file hg.pid + $ cat hg.pid >> $DAEMON_PIDS + + $ hg init pull-dst + $ cat > pull-dst/.hg/hgrc < [extensions] + > # enable locally + > largefiles= + > [largefiles] + > # ignore system cache to force largefiles specific wire proto access + > usercache=$TESTTMP/individualenabling/usercache + > EOF + $ hg -R pull-dst -q pull -u http://localhost:$HGPORT + + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS +#endif + $ cd .. diff --git a/tests/test-mq-qfold.t b/tests/test-mq-qfold.t --- a/tests/test-mq-qfold.t +++ b/tests/test-mq-qfold.t @@ -144,7 +144,7 @@ Test saving last-message.txt: $ hg qrefresh -m "original message" - $ cat > $TESTDIR/commitfailure.py < $TESTTMP/commitfailure.py < from mercurial import util > def reposetup(ui, repo): > class commitfailure(repo.__class__): @@ -155,10 +155,10 @@ Test saving last-message.txt: $ cat > .hg/hgrc < [extensions] - > commitfailure = $TESTDIR/commitfailure.py + > commitfailure = $TESTTMP/commitfailure.py > EOF - $ cat > $TESTDIR/editor.sh << EOF + $ cat > $TESTTMP/editor.sh << EOF > echo "==== before editing" > cat \$1 > echo "====" @@ -166,7 +166,7 @@ Test saving last-message.txt: > EOF $ rm -f .hg/last-message.txt - $ HGEDITOR="sh $TESTDIR/editor.sh" hg qfold -e p3 + $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3 ==== before editing original message==== refresh interrupted while patch was popped! (revert --all, qpush to recover) diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t --- a/tests/test-mq-qnew.t +++ b/tests/test-mq-qnew.t @@ -239,7 +239,7 @@ Test saving last-message.txt $ hg init repo $ cd repo - $ cat > $TESTDIR/commitfailure.py < $TESTTMP/commitfailure.py < from mercurial import util > def reposetup(ui, repo): > class commitfailure(repo.__class__): @@ -249,10 +249,10 @@ Test saving last-message.txt > EOF $ cat > .hg/hgrc < [extensions] - > commitfailure = $TESTDIR/commitfailure.py + > commitfailure = $TESTTMP/commitfailure.py > EOF - $ cat > $TESTDIR/editor.sh << EOF + $ cat > $TESTTMP/editor.sh << EOF > echo "==== before editing" > cat \$1 > echo "====" @@ -260,7 +260,7 @@ Test saving last-message.txt > EOF $ rm -f .hg/last-message.txt - $ HGEDITOR="sh $TESTDIR/editor.sh" hg qnew -e patch + $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch ==== before editing ==== abort: emulating unexpected abort