diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py index 44fd4cfc6c0ad3107cacad10c76ed38bd74948f4_bWVyY3VyaWFsL2NtZHV0aWwucHk=..786289423e97f2030744e49ba43a0ff51c469964_bWVyY3VyaWFsL2NtZHV0aWwucHk= 100644 --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -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 --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py index 44fd4cfc6c0ad3107cacad10c76ed38bd74948f4_bWVyY3VyaWFsL2RlYnVnY29tbWFuZHMucHk=..786289423e97f2030744e49ba43a0ff51c469964_bWVyY3VyaWFsL2RlYnVnY29tbWFuZHMucHk= 100644 --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -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 --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py index 44fd4cfc6c0ad3107cacad10c76ed38bd74948f4_bWVyY3VyaWFsL2hnd2ViL3dlYnV0aWwucHk=..786289423e97f2030744e49ba43a0ff51c469964_bWVyY3VyaWFsL2hnd2ViL3dlYnV0aWwucHk= 100644 --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -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 --git a/tests/test-diffstat.t b/tests/test-diffstat.t index 44fd4cfc6c0ad3107cacad10c76ed38bd74948f4_dGVzdHMvdGVzdC1kaWZmc3RhdC50..786289423e97f2030744e49ba43a0ff51c469964_dGVzdHMvdGVzdC1kaWZmc3RhdC50 100644 --- a/tests/test-diffstat.t +++ b/tests/test-diffstat.t @@ -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 --git a/tests/test-hgweb-diffs.t b/tests/test-hgweb-diffs.t index 44fd4cfc6c0ad3107cacad10c76ed38bd74948f4_dGVzdHMvdGVzdC1oZ3dlYi1kaWZmcy50..786289423e97f2030744e49ba43a0ff51c469964_dGVzdHMvdGVzdC1oZ3dlYi1kaWZmcy50 100644 --- a/tests/test-hgweb-diffs.t +++ b/tests/test-hgweb-diffs.t @@ -306,6 +306,23 @@ </html> +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(-) + <span id="l1.2" class="minusline">--- /dev/null</span><a href="#l1.2"></a> + <span id="l1.3" class="plusline">+++ a</span><a href="#l1.3"></a> + <span id="l2.2" class="minusline">--- /dev/null</span><a href="#l2.2"></a> + <span id="l2.3" class="plusline">+++ b</span><a href="#l2.3"></a> + set up hgweb with git diffs $ killdaemons.py