<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 4:43 AM, Matt Harbison <span dir="ltr"><<a href="mailto:mharbison72@gmail.com" target="_blank">mharbison72@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Matt Harbison <<a href="mailto:matt_harbison@yahoo.com" target="_blank">matt_harbison@yahoo.com</a>><br>
# Date 1424984034 18000<br>
# Thu Feb 26 15:53:54 2015 -0500<br>
# Node ID 72f885c8b7aff110a147cc7ff12f5951bf5aaf03<br>
# Parent 67952dc7a88faf32211e61b8f9606f62d271eaf3<br>
subrepo: don't exclude files in .hgignore when adding to git<br>
<br>
The previous test gave a false success because only an hg-ignored pattern was<br>
specified. Therefore match.files() was empty, and it fell back to the files<br>
unknown to git. The simplest fix is to always consider what is unknown to git,<br>
as well as anything specified explicitly. Files that are ignored by git can<br>
only be introduced by an explicit mention in match.files().<br></blockquote><div><br></div><div>This looks good to me.<br><br></div><div>Greetings,<br></div><div>Mathias <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py<br>
--- a/mercurial/subrepo.py<br>
+++ b/mercurial/subrepo.py<br>
@@ -1526,14 +1526,15 @@<br>
def add(self, ui, match, prefix, explicitonly, **opts):<br>
if self._gitmissing():<br>
return []<br>
- if match.files():<br>
- files = match.files()<br>
- else:<br>
- (modified, added, removed,<br>
- deleted, unknown, ignored, clean) = self.status(None)<br>
- files = unknown<br>
<br>
- files = [f for f in files if match(f)]<br>
+ (modified, added, removed,<br>
+ deleted, unknown, ignored, clean) = self.status(None)<br>
+<br>
+ # Unknown files not of interest will be rejected by the matcher<br>
+ files = unknown<br>
+ files.extend(match.files())<br>
+<br>
+ files = [f for f in sorted(set(files)) if match(f)]<br>
for f in files:<br>
exact = match.exact(f)<br>
command = ["add"]<br>
diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t<br>
--- a/tests/test-subrepo-git.t<br>
+++ b/tests/test-subrepo-git.t<br>
@@ -922,11 +922,11 @@<br>
> *.python<br>
> EOF<br>
$ hg add .hgignore<br>
- $ hg add --subrepos "glob:**.python"<br>
+ $ hg add --subrepos "glob:**.python" s/barfoo<br>
adding s/snake.python (glob)<br>
$ hg st --subrepos s<br>
+ A s/barfoo<br>
A s/snake.python<br>
- ? s/barfoo<br>
? s/c.c<br>
? s/cpp.cpp<br>
? s/foobar.orig<br>
</blockquote></div><br></div></div>