Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 39592:fa4d16daf1be
context: don't count deleted files as candidates for path conflicts in IMM
This patch makes sure we don't consider the deleted files in our IMM wctx
as potential conflicts while calculating paths conflicts. This fixes the bug
demonstrated in previous patch.
Differential Revision: https://phab.mercurial-scm.org/D4543
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Wed, 12 Sep 2018 17:45:43 +0300 |
parents | f6f52841e1ff |
children | 7375a9ab0149 |
comparison
equal
deleted
inserted
replaced
39591:aa022f8873ea | 39592:fa4d16daf1be |
---|---|
1908 | 1908 |
1909 # Test the other direction -- that this path from p2 isn't a directory | 1909 # Test the other direction -- that this path from p2 isn't a directory |
1910 # in p1 (test that p1 doesn't any paths matching `path/*`). | 1910 # in p1 (test that p1 doesn't any paths matching `path/*`). |
1911 match = matchmod.match('/', '', [path + '/'], default=b'relpath') | 1911 match = matchmod.match('/', '', [path + '/'], default=b'relpath') |
1912 matches = self.p1().manifest().matches(match) | 1912 matches = self.p1().manifest().matches(match) |
1913 if len(matches) > 0: | 1913 mfiles = matches.keys() |
1914 if len(matches) == 1 and matches.keys()[0] == path: | 1914 if len(mfiles) > 0: |
1915 if len(mfiles) == 1 and mfiles[0] == path: | |
1916 return | |
1917 # omit the files which are deleted in current IMM wctx | |
1918 mfiles = [m for m in mfiles if self._cache[m]['exists']] | |
1919 if not mfiles: | |
1915 return | 1920 return |
1916 raise error.Abort("error: file '%s' cannot be written because " | 1921 raise error.Abort("error: file '%s' cannot be written because " |
1917 " '%s/' is a folder in %s (containing %d " | 1922 " '%s/' is a folder in %s (containing %d " |
1918 "entries: %s)" | 1923 "entries: %s)" |
1919 % (path, path, self.p1(), len(matches), | 1924 % (path, path, self.p1(), len(mfiles), |
1920 ', '.join(matches.keys()))) | 1925 ', '.join(mfiles))) |
1921 | 1926 |
1922 def write(self, path, data, flags='', **kwargs): | 1927 def write(self, path, data, flags='', **kwargs): |
1923 if data is None: | 1928 if data is None: |
1924 raise error.ProgrammingError("data must be non-None") | 1929 raise error.ProgrammingError("data must be non-None") |
1925 self._auditconflicts(path) | 1930 self._auditconflicts(path) |