diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c --- a/mercurial/bdiff.c +++ b/mercurial/bdiff.c @@ -34,7 +34,7 @@ static uint32_t htonl(uint32_t x) } #else #include -#ifdef __BEOS__ +#if defined __BEOS__ && !defined __HAIKU__ #include #else #include diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -6,7 +6,8 @@ # of the GNU General Public License, incorporated herein by reference. from node import bin, hex, nullid -from revlog import revlog +from revlog import revlog, RevlogError +from i18n import _ import util def _string_escape(text): @@ -176,6 +177,9 @@ class changelog(revlog): def add(self, manifest, files, desc, transaction, p1=None, p2=None, user=None, date=None, extra={}): + user = user.strip() + if "\n" in user: + raise RevlogError(_("username %s contains a newline") % `user`) user, desc = util.fromlocal(user), util.fromlocal(desc) if date: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2814,7 +2814,8 @@ def update(ui, repo, node=None, rev=None """update working directory Update the repository's working directory to the specified revision, - or the tip of the current branch if none is specified. + or the tip of the current branch if none is specified. Use null as + the revision to remove the working copy (like 'hg clone -U'). If the requested revision is a descendant of the working directory, any outstanding changes in the working directory will diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c --- a/mercurial/mpatch.c +++ b/mercurial/mpatch.c @@ -52,7 +52,7 @@ static uint32_t ntohl(uint32_t x) #else /* not windows */ # include -# ifdef __BEOS__ +# if defined __BEOS__ && !defined __HAIKU__ # include # else # include diff --git a/tests/test-highlight b/tests/test-highlight --- a/tests/test-highlight +++ b/tests/test-highlight @@ -20,11 +20,11 @@ cat hg.pid >> $DAEMON_PIDS echo % hgweb filerevision, html ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/get-with-headers.py') \ - | sed "s/[0-9]* years ago/long ago/g" + | sed "s/[0-9]* years ago/long ago/g" | sed "s/class=\"k\"/class=\"kn\"/g" echo % hgweb fileannotate, html ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/get-with-headers.py') \ - | sed "s/[0-9]* years ago/long ago/g" + | sed "s/[0-9]* years ago/long ago/g" | sed "s/class=\"k\"/class=\"kn\"/g" echo % hgweb fileannotate, raw ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/get-with-headers.py?style=raw') \ diff --git a/tests/test-highlight.out b/tests/test-highlight.out --- a/tests/test-highlight.out +++ b/tests/test-highlight.out @@ -51,7 +51,7 @@ 200 Script output follows
-
1#!/usr/bin/env python
3__doc__ = """This does HTTP get requests given a host:port and path and returns
4a subset of the headers plus the body of the result."""
6import httplib, sys
7headers = [h.lower() for h in sys.argv[3:]]
8conn = httplib.HTTPConnection(sys.argv[1])
9conn.request("GET", sys.argv[2])
10response = conn.getresponse()
11print response.status, response.reason
12for h in headers:
13 if response.getheader(h, None) is not None:
14 print "%s: %s" % (h, response.getheader(h))
15print
16sys.stdout.write(response.read())
18if 200 <= response.status <= 299:
19 sys.exit(0)
20sys.exit(1)
+
1#!/usr/bin/env python
3__doc__ = """This does HTTP get requests given a host:port and path and returns
4a subset of the headers plus the body of the result."""
6import httplib, sys
7headers = [h.lower() for h in sys.argv[3:]]
8conn = httplib.HTTPConnection(sys.argv[1])
9conn.request("GET", sys.argv[2])
10response = conn.getresponse()
11print response.status, response.reason
12for h in headers:
13 if response.getheader(h, None) is not None:
14 print "%s: %s" % (h, response.getheader(h))
15print
16sys.stdout.write(response.read())
18if 200 <= response.status <= 299:
19 sys.exit(0)
20sys.exit(1)
@@ -118,7 +118,7 @@ 200 Script output follows
- +
test@0 1
#!/usr/bin/env python
test@0 2
test@0 3
__doc__ = """This does HTTP get requests given a host:port and path and returns
test@0 4
a subset of the headers plus the body of the result."""
test@0 5
test@0 6
import httplib, sys
test@0 7
headers = [h.lower() for h in sys.argv[3:]]
test@0 8
conn = httplib.HTTPConnection(sys.argv[1])
test@0 9
conn.request("GET", sys.argv[2])
test@0 10
response = conn.getresponse()
test@0 11
print response.status, response.reason
test@0 12
for h in headers:
test@0 13
    if response.getheader(h, None) is not None:
test@0 14
        print "%s: %s" % (h, response.getheader(h))
test@0 15
print
test@0 16
sys.stdout.write(response.read())
test@0 17
test@0 18
if 200 <= response.status <= 299:
test@0 19
    sys.exit(0)
test@0 20
sys.exit(1)
test@0 1
#!/usr/bin/env python
test@0 2
test@0 3
__doc__ = """This does HTTP get requests given a host:port and path and returns
test@0 4
a subset of the headers plus the body of the result."""
test@0 5
test@0 6
import httplib, sys
test@0 7
headers = [h.lower() for h in sys.argv[3:]]
test@0 8
conn = httplib.HTTPConnection(sys.argv[1])
test@0 9
conn.request("GET", sys.argv[2])
test@0 10
response = conn.getresponse()
test@0 11
print response.status, response.reason
test@0 12
for h in headers:
test@0 13
    if response.getheader(h, None) is not None:
test@0 14
        print "%s: %s" % (h, response.getheader(h))
test@0 15
print
test@0 16
sys.stdout.write(response.read())
test@0 17
test@0 18
if 200 <= response.status <= 299:
test@0 19
    sys.exit(0)
test@0 20
sys.exit(1)
diff --git a/tests/test-username-newline b/tests/test-username-newline new file mode 100755 --- /dev/null +++ b/tests/test-username-newline @@ -0,0 +1,22 @@ +#!/bin/sh +# + +hg init foo +cd foo +touch a + + +unset HGUSER +echo "[ui]" >> .hg/hgrc +echo "username= foo" >> .hg/hgrc +echo " bar1" >> .hg/hgrc + +hg ci -Am m + +rm .hg/hgrc + +HGUSER=`(echo foo; echo bar2)` hg ci -Am m + +hg ci -Am m -u "`(echo foo; echo bar3)`" + +true diff --git a/tests/test-username-newline.out b/tests/test-username-newline.out new file mode 100644 --- /dev/null +++ b/tests/test-username-newline.out @@ -0,0 +1,8 @@ +adding a +abort: username 'foo\nbar1' contains a newline + +abort: username 'foo\nbar2' contains a newline + +transaction abort! +rollback completed +abort: username 'foo\nbar3' contains a newline!