# HG changeset patch # User Augie Fackler # Date 1513718844 18000 # Node ID 786289423e97f2030744e49ba43a0ff51c469964 # Parent 44fd4cfc6c0ad3107cacad10c76ed38bd74948f4# Parent 058c725925e33d70020f590dc44b94e945205c61 merge with stable diff -r 44fd4cfc6c0a -r 786289423e97 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Mon Dec 18 15:18:37 2017 -0800 +++ b/mercurial/cmdutil.py Tue Dec 19 16:27:24 2017 -0500 @@ -1515,7 +1515,7 @@ match.uipath(matchroot), uirelroot)) if stat: - diffopts = diffopts.copy(context=0) + diffopts = diffopts.copy(context=0, noprefix=False) width = 80 if not ui.plain(): width = ui.termwidth() diff -r 44fd4cfc6c0a -r 786289423e97 mercurial/debugcommands.py --- a/mercurial/debugcommands.py Mon Dec 18 15:18:37 2017 -0800 +++ b/mercurial/debugcommands.py Tue Dec 19 16:27:24 2017 -0500 @@ -2223,10 +2223,12 @@ url = util.url(source) addr = None - if url.scheme == 'https': - addr = (url.host, url.port or 443) - elif url.scheme == 'ssh': - addr = (url.host, url.port or 22) + defaultport = {'https': 443, 'ssh': 22} + if url.scheme in defaultport: + try: + addr = (url.host, int(url.port or defaultport[url.scheme])) + except ValueError: + raise error.Abort(_("malformed port number in URL")) else: raise error.Abort(_("only https and ssh connections are supported")) diff -r 44fd4cfc6c0a -r 786289423e97 mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py Mon Dec 18 15:18:37 2017 -0800 +++ b/mercurial/hgweb/webutil.py Tue Dec 19 16:27:24 2017 -0500 @@ -547,7 +547,8 @@ def diffstatgen(ctx, basectx): '''Generator function that provides the diffstat data.''' - stats = patch.diffstatdata(util.iterlines(ctx.diff(basectx))) + stats = patch.diffstatdata( + util.iterlines(ctx.diff(basectx, noprefix=False))) maxname, maxtotal, addtotal, removetotal, binary = patch.diffstatsum(stats) while True: yield stats, maxname, maxtotal, addtotal, removetotal, binary diff -r 44fd4cfc6c0a -r 786289423e97 tests/test-diffstat.t --- a/tests/test-diffstat.t Mon Dec 18 15:18:37 2017 -0800 +++ b/tests/test-diffstat.t Tue Dec 19 16:27:24 2017 -0500 @@ -69,6 +69,57 @@ file with spaces | Bin 1 files changed, 0 insertions(+), 0 deletions(-) +Filename without "a/" or "b/" (issue5759): + + $ hg diff --config 'diff.noprefix=1' -c1 --stat --git + a | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + $ hg diff --config 'diff.noprefix=1' -c2 --stat --git + c | Bin + d | 0 + 2 files changed, 0 insertions(+), 0 deletions(-) + + $ hg log --config 'diff.noprefix=1' -r '1:' -p --stat --git + changeset: 1:3a95b07bb77f + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: appenda + + a | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + + diff --git a a + --- a + +++ a + @@ -211,3 +211,6 @@ + a + a + a + +a + +a + +a + + changeset: 2:c60a6c753773 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: createb + + c | Bin + d | 0 + 2 files changed, 0 insertions(+), 0 deletions(-) + + diff --git c c + new file mode 100644 + index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f76dd238ade08917e6712764a16a22005a50573d + GIT binary patch + literal 1 + Ic${MZ000310RR91 + + diff --git d d + new file mode 100644 + + diffstat within directories: $ hg rm -f 'file with spaces' diff -r 44fd4cfc6c0a -r 786289423e97 tests/test-hgweb-diffs.t --- a/tests/test-hgweb-diffs.t Mon Dec 18 15:18:37 2017 -0800 +++ b/tests/test-hgweb-diffs.t Tue Dec 19 16:27:24 2017 -0500 @@ -306,6 +306,23 @@ +set up hgweb with git diffs + noprefix + + $ killdaemons.py + $ hg serve --config 'diff.git=1' --config 'diff.noprefix=1' -p $HGPORT -d \ + > --pid-file=hg.pid -A access.log -E errors.log + $ cat hg.pid >> $DAEMON_PIDS + +patch header and diffstat + + $ get-with-headers.py localhost:$HGPORT 'rev/0' \ + > | egrep 'files changed|---|\+\+\+' + 2 files changed, 2 insertions(+), 0 deletions(-) + --- /dev/null + +++ a + --- /dev/null + +++ b + set up hgweb with git diffs $ killdaemons.py