Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 24182:00ef3edcf1d5
subrepo: don't exclude files in .hgignore when adding to git
The previous test gave a false success because only an hg-ignored pattern was
specified. Therefore match.files() was empty, and it fell back to the files
unknown to git. The simplest fix is to always consider what is unknown to git,
as well as anything specified explicitly. Files that are ignored by git can
only be introduced by an explicit mention in match.files().
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 26 Feb 2015 15:53:54 -0500 |
parents | bd9f64ec891d |
children | 932de135041f |
comparison
equal
deleted
inserted
replaced
24181:5245caa0dcde | 24182:00ef3edcf1d5 |
---|---|
1524 | 1524 |
1525 @annotatesubrepoerror | 1525 @annotatesubrepoerror |
1526 def add(self, ui, match, prefix, explicitonly, **opts): | 1526 def add(self, ui, match, prefix, explicitonly, **opts): |
1527 if self._gitmissing(): | 1527 if self._gitmissing(): |
1528 return [] | 1528 return [] |
1529 if match.files(): | 1529 |
1530 files = match.files() | 1530 (modified, added, removed, |
1531 else: | 1531 deleted, unknown, ignored, clean) = self.status(None) |
1532 (modified, added, removed, | 1532 |
1533 deleted, unknown, ignored, clean) = self.status(None) | 1533 # Unknown files not of interest will be rejected by the matcher |
1534 files = unknown | 1534 files = unknown |
1535 | 1535 files.extend(match.files()) |
1536 files = [f for f in files if match(f)] | 1536 |
1537 files = [f for f in sorted(set(files)) if match(f)] | |
1537 for f in files: | 1538 for f in files: |
1538 exact = match.exact(f) | 1539 exact = match.exact(f) |
1539 command = ["add"] | 1540 command = ["add"] |
1540 if exact: | 1541 if exact: |
1541 command.append("-f") #should be added, even if ignored | 1542 command.append("-f") #should be added, even if ignored |