D5886: subrepo: adjust subrepo prefix before calling subrepo.diff() (API)

2019-02-07 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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
@@ -118,8 +118,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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5886: subrepo: adjust subrepo prefix before calling subrepo.diff() (API)

2019-02-08 Thread martinvonz (Martin von Zweigbergk)
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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5886: subrepo: adjust subrepo prefix before calling subrepo.diff() (API)

2019-02-09 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3d094bfaf885: subrepo: adjust subrepo prefix before calling 
subrepo.diff() (API) (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5886?vs=13925&id=13960

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
@@ -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"""



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel