merge with stable
authorKevin Bullock <kbullock@ringworld.org>
Mon, 31 Mar 2014 10:12:07 -0500
changeset 20860 81d6dc8c3c63
parent 20856 8a6a86c9a5b5 (current diff)
parent 20859 e259d4c462b5 (diff)
child 20861 c2a81aa19980
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).
hgext/largefiles/reposetup.py
mercurial/hg.py
mercurial/templater.py
tests/test-command-template.t
tests/test-commit.t
tests/test-largefiles.t
--- a/hgext/largefiles/__init__.py	Tue Mar 18 14:29:33 2014 -0700
+++ b/hgext/largefiles/__init__.py	Mon Mar 31 10:12:07 2014 -0500
@@ -105,9 +105,10 @@
 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 uisetup(ui):
     localrepo.localrepository.featuresetupfuncs.add(featuresetup)
+    hg.wirepeersetupfuncs.append(proto.wirereposetup)
     uisetupmod.uisetup(ui)
 
 commands.norepo += " lfconvert"
--- a/hgext/largefiles/reposetup.py	Tue Mar 18 14:29:33 2014 -0700
+++ b/hgext/largefiles/reposetup.py	Mon Mar 31 10:12:07 2014 -0500
@@ -16,14 +16,13 @@
 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
--- a/mercurial/hg.py	Tue Mar 18 14:29:33 2014 -0700
+++ b/mercurial/hg.py	Mon Mar 31 10:12:07 2014 -0500
@@ -98,6 +98,9 @@
     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 @@
         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):
--- a/mercurial/templater.py	Tue Mar 18 14:29:33 2014 -0700
+++ b/mercurial/templater.py	Mon Mar 31 10:12:07 2014 -0500
@@ -212,6 +212,7 @@
             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):
--- a/tests/test-command-template.t	Tue Mar 18 14:29:33 2014 -0700
+++ b/tests/test-command-template.t	Mon Mar 31 10:12:07 2014 -0500
@@ -1439,6 +1439,12 @@
   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 ..
 
 
--- a/tests/test-commit.t	Tue Mar 18 14:29:33 2014 -0700
+++ b/tests/test-commit.t	Mon Mar 31 10:12:07 2014 -0500
@@ -299,7 +299,7 @@
   $ echo 'sub = sub' > .hgsub
   $ hg add .hgsub
 
-  $ cat > $TESTDIR/editor.sh <<EOF
+  $ cat > $TESTTMP/editor.sh <<EOF
   > echo "==== before editing:"
   > cat \$1
   > echo "===="
@@ -307,7 +307,7 @@
   > 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:
   
   
--- a/tests/test-histedit-fold.t	Tue Mar 18 14:29:33 2014 -0700
+++ b/tests/test-histedit-fold.t	Mon Mar 31 10:12:07 2014 -0500
@@ -107,7 +107,7 @@
 
 check saving last-message.txt
 
-  $ cat > $TESTDIR/abortfolding.py <<EOF
+  $ cat > $TESTTMP/abortfolding.py <<EOF
   > from mercurial import util
   > def abortfolding(ui, repo, hooktype, **kwargs):
   >     ctx = repo[kwargs.get('node')]
@@ -117,10 +117,10 @@
   > EOF
   $ cat > .hg/hgrc <<EOF
   > [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 @@
   > EOF
 
   $ rm -f .hg/last-message.txt
-  $ HGEDITOR="sh $TESTDIR/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
+  $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
   > pick 6de59d13424a f
   > fold 9c277da72c9b d
   > EOF
--- a/tests/test-largefiles.t	Tue Mar 18 14:29:33 2014 -0700
+++ b/tests/test-largefiles.t	Mon Mar 31 10:12:07 2014 -0500
@@ -2287,4 +2287,30 @@
   $ 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 <<EOF
+  > [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 ..
--- a/tests/test-mq-qfold.t	Tue Mar 18 14:29:33 2014 -0700
+++ b/tests/test-mq-qfold.t	Mon Mar 31 10:12:07 2014 -0500
@@ -144,7 +144,7 @@
 
   $ hg qrefresh -m "original message"
 
-  $ cat > $TESTDIR/commitfailure.py <<EOF
+  $ cat > $TESTTMP/commitfailure.py <<EOF
   > from mercurial import util
   > def reposetup(ui, repo):
   >     class commitfailure(repo.__class__):
@@ -155,10 +155,10 @@
 
   $ cat > .hg/hgrc <<EOF
   > [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 @@
   > 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)
--- a/tests/test-mq-qnew.t	Tue Mar 18 14:29:33 2014 -0700
+++ b/tests/test-mq-qnew.t	Mon Mar 31 10:12:07 2014 -0500
@@ -239,7 +239,7 @@
   $ hg init repo
   $ cd repo
 
-  $ cat > $TESTDIR/commitfailure.py <<EOF
+  $ cat > $TESTTMP/commitfailure.py <<EOF
   > from mercurial import util
   > def reposetup(ui, repo):
   >     class commitfailure(repo.__class__):
@@ -249,10 +249,10 @@
   > EOF
   $ cat > .hg/hgrc <<EOF
   > [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 @@
   > 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