mercurial/context.py
changeset 39576 fa4d16daf1be
parent 39292 f6f52841e1ff
child 39710 7375a9ab0149
equal deleted inserted replaced
39575:aa022f8873ea 39576: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)