D5886: subrepo: adjust subrepo prefix before calling subrepo.diff() (API)
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Feb 8 15:18:55 EST 2019
martinvonz updated this revision to Diff 13925.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5886?vs=13897&id=13925
REVISION DETAIL
https://phab.mercurial-scm.org/D5886
AFFECTED FILES
mercurial/logcmdutil.py
mercurial/subrepo.py
CHANGE DETAILS
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -11,7 +11,6 @@
import errno
import hashlib
import os
-import posixpath
import re
import stat
import subprocess
@@ -556,10 +555,9 @@
# in hex format
if node2 is not None:
node2 = node.bin(node2)
- logcmdutil.diffordiffstat(ui, self._repo, diffopts,
- node1, node2, match,
- prefix=posixpath.join(prefix, self._path),
- listsubrepos=True, **opts)
+ logcmdutil.diffordiffstat(ui, self._repo, diffopts, node1, node2,
+ match, prefix=prefix, listsubrepos=True,
+ **opts)
except error.RepoLookupError as inst:
self.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
% (inst, subrelpath(self)))
@@ -1779,14 +1777,12 @@
# for Git, this also implies '-p'
cmd.append('-U%d' % diffopts.context)
- gitprefix = self.wvfs.reljoin(prefix, self._path)
-
if diffopts.noprefix:
- cmd.extend(['--src-prefix=%s/' % gitprefix,
- '--dst-prefix=%s/' % gitprefix])
+ cmd.extend(['--src-prefix=%s/' % prefix,
+ '--dst-prefix=%s/' % prefix])
else:
- cmd.extend(['--src-prefix=a/%s/' % gitprefix,
- '--dst-prefix=b/%s/' % gitprefix])
+ cmd.extend(['--src-prefix=a/%s/' % prefix,
+ '--dst-prefix=b/%s/' % prefix])
if diffopts.ignorews:
cmd.append('--ignore-all-space')
diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -117,8 +117,9 @@
# subpath. The best we can do is to ignore it.
tempnode2 = None
submatch = matchmod.subdirmatcher(subpath, match)
+ subprefix = repo.wvfs.reljoin(prefix, subpath)
sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
- stat=stat, fp=fp, prefix=prefix)
+ stat=stat, fp=fp, prefix=subprefix)
class changesetdiffer(object):
"""Generate diff of changeset with pre-configured filtering functions"""
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list