Mercurial > hg-stable
changeset 41641:3d094bfaf885
subrepo: adjust subrepo prefix before calling subrepo.diff() (API)
Differential Revision: https://phab.mercurial-scm.org/D5886
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 07 Feb 2019 09:52:36 -0800 |
parents | 5ee3c49fc9cd |
children | 3d9d5e612e67 |
files | mercurial/logcmdutil.py mercurial/subrepo.py |
diffstat | 2 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/logcmdutil.py Thu Feb 07 10:01:55 2019 -0800 +++ b/mercurial/logcmdutil.py Thu Feb 07 09:52:36 2019 -0800 @@ -123,8 +123,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"""
--- a/mercurial/subrepo.py Thu Feb 07 10:01:55 2019 -0800 +++ b/mercurial/subrepo.py Thu Feb 07 09:52:36 2019 -0800 @@ -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')