Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 28618:7dab4caf11bc stable
subrepo: adapt to git's recent renames-by-default
Git turned on renames by default in commit 5404c11 (diff: activate
diff.renames by default, 2016-02-25). The change is destined for
release in git 2.8.0. The change breaks test-subrepo-git, which test
specifically that a moved file is reported as a removal and an
addition. Fix by passing --no-renames (available in git since mid
2006) to the diff commands that don't use --quiet (should make no
difference for those).
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 24 Mar 2016 09:38:11 -0700 |
parents | 594bdc380aa2 |
children | 345f4fa4cc89 34d43cb85de8 |
comparison
equal
deleted
inserted
replaced
28518:aa440c3d7c5d | 28618:7dab4caf11bc |
---|---|
1808 # if the repo is missing, return no results | 1808 # if the repo is missing, return no results |
1809 return scmutil.status([], [], [], [], [], [], []) | 1809 return scmutil.status([], [], [], [], [], [], []) |
1810 modified, added, removed = [], [], [] | 1810 modified, added, removed = [], [], [] |
1811 self._gitupdatestat() | 1811 self._gitupdatestat() |
1812 if rev2: | 1812 if rev2: |
1813 command = ['diff-tree', '-r', rev1, rev2] | 1813 command = ['diff-tree', '--no-renames', '-r', rev1, rev2] |
1814 else: | 1814 else: |
1815 command = ['diff-index', rev1] | 1815 command = ['diff-index', '--no-renames', rev1] |
1816 out = self._gitcommand(command) | 1816 out = self._gitcommand(command) |
1817 for line in out.split('\n'): | 1817 for line in out.split('\n'): |
1818 tab = line.find('\t') | 1818 tab = line.find('\t') |
1819 if tab == -1: | 1819 if tab == -1: |
1820 continue | 1820 continue |
1869 unknown, ignored, clean) | 1869 unknown, ignored, clean) |
1870 | 1870 |
1871 @annotatesubrepoerror | 1871 @annotatesubrepoerror |
1872 def diff(self, ui, diffopts, node2, match, prefix, **opts): | 1872 def diff(self, ui, diffopts, node2, match, prefix, **opts): |
1873 node1 = self._state[1] | 1873 node1 = self._state[1] |
1874 cmd = ['diff'] | 1874 cmd = ['diff', '--no-renames'] |
1875 if opts['stat']: | 1875 if opts['stat']: |
1876 cmd.append('--stat') | 1876 cmd.append('--stat') |
1877 else: | 1877 else: |
1878 # for Git, this also implies '-p' | 1878 # for Git, this also implies '-p' |
1879 cmd.append('-U%d' % diffopts.context) | 1879 cmd.append('-U%d' % diffopts.context) |