##// END OF EJS Templates
subrepo: adjust subrepo prefix before calling subrepo.diff() (API)...
Martin von Zweigbergk -
r41779:3d094bfa default
parent child Browse files
Show More
@@ -123,8 +123,9 b' def diffordiffstat(ui, repo, diffopts, n'
123 # subpath. The best we can do is to ignore it.
123 # subpath. The best we can do is to ignore it.
124 tempnode2 = None
124 tempnode2 = None
125 submatch = matchmod.subdirmatcher(subpath, match)
125 submatch = matchmod.subdirmatcher(subpath, match)
126 subprefix = repo.wvfs.reljoin(prefix, subpath)
126 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
127 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
127 stat=stat, fp=fp, prefix=prefix)
128 stat=stat, fp=fp, prefix=subprefix)
128
129
129 class changesetdiffer(object):
130 class changesetdiffer(object):
130 """Generate diff of changeset with pre-configured filtering functions"""
131 """Generate diff of changeset with pre-configured filtering functions"""
@@ -11,7 +11,6 b' import copy'
11 import errno
11 import errno
12 import hashlib
12 import hashlib
13 import os
13 import os
14 import posixpath
15 import re
14 import re
16 import stat
15 import stat
17 import subprocess
16 import subprocess
@@ -556,10 +555,9 b' class hgsubrepo(abstractsubrepo):'
556 # in hex format
555 # in hex format
557 if node2 is not None:
556 if node2 is not None:
558 node2 = node.bin(node2)
557 node2 = node.bin(node2)
559 logcmdutil.diffordiffstat(ui, self._repo, diffopts,
558 logcmdutil.diffordiffstat(ui, self._repo, diffopts, node1, node2,
560 node1, node2, match,
559 match, prefix=prefix, listsubrepos=True,
561 prefix=posixpath.join(prefix, self._path),
560 **opts)
562 listsubrepos=True, **opts)
563 except error.RepoLookupError as inst:
561 except error.RepoLookupError as inst:
564 self.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
562 self.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
565 % (inst, subrelpath(self)))
563 % (inst, subrelpath(self)))
@@ -1779,14 +1777,12 b' class gitsubrepo(abstractsubrepo):'
1779 # for Git, this also implies '-p'
1777 # for Git, this also implies '-p'
1780 cmd.append('-U%d' % diffopts.context)
1778 cmd.append('-U%d' % diffopts.context)
1781
1779
1782 gitprefix = self.wvfs.reljoin(prefix, self._path)
1783
1784 if diffopts.noprefix:
1780 if diffopts.noprefix:
1785 cmd.extend(['--src-prefix=%s/' % gitprefix,
1781 cmd.extend(['--src-prefix=%s/' % prefix,
1786 '--dst-prefix=%s/' % gitprefix])
1782 '--dst-prefix=%s/' % prefix])
1787 else:
1783 else:
1788 cmd.extend(['--src-prefix=a/%s/' % gitprefix,
1784 cmd.extend(['--src-prefix=a/%s/' % prefix,
1789 '--dst-prefix=b/%s/' % gitprefix])
1785 '--dst-prefix=b/%s/' % prefix])
1790
1786
1791 if diffopts.ignorews:
1787 if diffopts.ignorews:
1792 cmd.append('--ignore-all-space')
1788 cmd.append('--ignore-all-space')
General Comments 0
You need to be logged in to leave comments. Login now