--- a/mercurial/hg.py Wed Sep 17 22:15:36 2008 +0200
+++ b/mercurial/hg.py Mon Sep 22 14:47:21 2008 +0200
@@ -223,7 +223,8 @@
if dest_repo.local():
fp = dest_repo.opener("hgrc", "w", text=True)
fp.write("[paths]\n")
- fp.write("default = %s\n" % abspath)
+ # percent needs to be escaped for ConfigParser
+ fp.write("default = %s\n" % abspath.replace('%', '%%'))
fp.close()
if update:
--- a/tests/test-doctest.py Wed Sep 17 22:15:36 2008 +0200
+++ b/tests/test-doctest.py Mon Sep 22 14:47:21 2008 +0200
@@ -1,3 +1,5 @@
+# this is hack to make sure no escape characters are inserted into the output
+import os; del os.environ['TERM']
import doctest
import mercurial.changelog
--- a/tests/test-hgrc Wed Sep 17 22:15:36 2008 +0200
+++ b/tests/test-hgrc Mon Sep 22 14:47:21 2008 +0200
@@ -5,3 +5,14 @@
hg init
echo "invalid" > .hg/hgrc
hg status 2>&1 |sed -e "s:/.*\(/t/.*\):...\1:"
+
+#issue 1199, escaping
+
+cd ..
+hg init "foo%bar"
+hg clone "foo%bar" foobar
+p=`pwd`
+cd foobar
+cat .hg/hgrc |sed -e "s:$p:...:"
+hg paths |sed -e "s:$p:...:"
+hg showconfig |sed -e "s:$p:...:"
--- a/tests/test-hgrc.out Wed Sep 17 22:15:36 2008 +0200
+++ b/tests/test-hgrc.out Mon Sep 22 14:47:21 2008 +0200
@@ -2,3 +2,15 @@
File contains no section headers.
file: .../t/.hg/hgrc, line: 1
'invalid\n'
+updating working directory
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+[paths]
+default = .../foo%%bar
+default = .../foo%bar
+bundle.mainreporoot=.../foobar
+defaults.backout=-d "0 0"
+defaults.commit=-d "0 0"
+defaults.debugrawcommit=-d "0 0"
+defaults.tag=-d "0 0"
+paths.default=.../foo%bar
+ui.slash=True
--- a/tests/test-mq Wed Sep 17 22:15:36 2008 +0200
+++ b/tests/test-mq Mon Sep 22 14:47:21 2008 +0200
@@ -520,7 +520,7 @@
hg qpush
echo % apply force, should not discard changes with empty patch
-hg qpush -f
+hg qpush -f 2>&1 | sed 's,^.*/patch,patch,g'
hg diff --config diff.nodates=True
hg qdiff --config diff.nodates=True
hg log -l1 -p
--- a/tests/test-mq.out Wed Sep 17 22:15:36 2008 +0200
+++ b/tests/test-mq.out Mon Sep 22 14:47:21 2008 +0200
@@ -500,7 +500,7 @@
abort: local changes found, refresh first
% apply force, should not discard changes with empty patch
applying empty
-/usr/bin/patch: **** Only garbage was found in the patch input.
+patch: **** Only garbage was found in the patch input.
patch failed, unable to continue (try -v)
patch empty is empty
Now at: empty
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-notify-changegroup Mon Sep 22 14:47:21 2008 +0200
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+cat <<EOF >> $HGRCPATH
+[extensions]
+notify=
+
+[hooks]
+changegroup.notify = python:hgext.notify.hook
+
+[notify]
+sources = push
+diffstat = False
+maxsubject = 200
+
+[usersubs]
+foo@bar = *
+
+[reposubs]
+* = baz
+EOF
+
+hg init a
+
+echo % clone
+hg --traceback clone a b
+
+echo a > b/a
+echo % commit
+hg --traceback --cwd b commit -Ama
+
+echo a >> b/a
+echo % commit
+hg --traceback --cwd b commit -Amb
+
+echo % push
+hg --traceback --cwd b push ../a 2>&1 |
+ python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),' |
+ sed -e 's/\(Message-Id:\).*/\1/' \
+ -e 's/changeset \([0-9a-f]* *\)in .*test-notif/changeset \1in test-notif/' \
+ -e 's/^Subject: .*test-notify/Subject: test-notify/' \
+ -e 's/^details: .*test-notify/details: test-notify/' \
+ -e 's/^Date:.*/Date:/'
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-notify-changegroup.out Mon Sep 22 14:47:21 2008 +0200
@@ -0,0 +1,36 @@
+% clone
+updating working directory
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+% commit
+adding a
+% commit
+% push
+pushing to ../a
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 2 changesets with 2 changes to 1 files
+Date:
+Subject: test-notify-changegroup/a: 2 new changesets
+From: test
+X-Hg-Notification: changeset cb9a9f314b8b
+Message-Id:
+To: baz, foo@bar
+
+changeset cb9a9f314b8b in test-notify-changegroup/a
+details: test-notify-changegroup/a?cmd=changeset;node=cb9a9f314b8b
+summary: a
+
+changeset ba677d0156c1 in test-notify-changegroup/a
+details: test-notify-changegroup/a?cmd=changeset;node=ba677d0156c1
+summary: b
+
+diffs (6 lines):
+
+diff -r 000000000000 -r ba677d0156c1 a
+--- /dev/null Thu Jan 01 00:00:00 1970 +0000
++++ b/a Thu Jan 01 00:00:00 1970 +0000
+@@ -0,0 +1,2 @@
++a
++a