Comments
Patch
@@ -871,7 +871,7 @@
reverting subrepo ../gitroot
$ hg add --subrepos "glob:**.python"
- adding s/snake.python
+ adding s/snake.python (glob)
$ hg st --subrepos s
A s/snake.python
? s/barfoo
@@ -882,11 +882,11 @@
reverting subrepo ../gitroot
$ hg add --subrepos s
- adding s/barfoo
- adding s/c.c
- adding s/cpp.cpp
- adding s/foobar.orig
- adding s/snake.python
+ adding s/barfoo (glob)
+ adding s/c.c (glob)
+ adding s/cpp.cpp (glob)
+ adding s/foobar.orig (glob)
+ adding s/snake.python (glob)
$ hg st --subrepos s
A s/barfoo
A s/c.c
@@ -904,10 +904,10 @@
? s/snake.python
$ hg add --subrepos --exclude "path:s/c.c"
- adding s/barfoo
- adding s/cpp.cpp
- adding s/foobar.orig
- adding s/snake.python
+ adding s/barfoo (glob)
+ adding s/cpp.cpp (glob)
+ adding s/foobar.orig (glob)
+ adding s/snake.python (glob)
$ hg st --subrepos s
A s/barfoo
A s/cpp.cpp
@@ -923,7 +923,7 @@
> EOF
$ hg add .hgignore
$ hg add --subrepos "glob:**.python"
- adding s/snake.python
+ adding s/snake.python (glob)
$ hg st --subrepos s
A s/snake.python
? s/barfoo
@@ -962,10 +962,10 @@
correctly do a dry run
$ hg add --subrepos s --dry-run
- adding s/barfoo
- adding s/c.c
- adding s/cpp.cpp
- adding s/foobar.orig
+ adding s/barfoo (glob)
+ adding s/c.c (glob)
+ adding s/cpp.cpp (glob)
+ adding s/foobar.orig (glob)
$ hg st --subrepos s
A s/.gitignore
A s/snake.python
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1424984034 18000
# Thu Feb 26 15:53:54 2015 -0500
# Node ID 127fa2cd0c50e6c3c0ee172c2060f64ccc5445a7
# Parent dbbf78fc43e049af6e2d7a9edc23c4ae5553686a
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().
@@ -1528,14 +1528,15 @@
if self._gitmissing():
return []
rev = self._state[1]
- if match.files():
- files = match.files()
- else:
- (modified, added, removed,
- deleted, unknown, ignored, clean) = self.status(None)
- files = unknown
- files = [f for f in files if match(f)]
+ (modified, added, removed,
+ deleted, unknown, ignored, clean) = self.status(None)
+
+ # Unknown files not of interest will be rejected by the matcher
+ files = unknown
+ files.extend(match.files())
+
+ files = [f for f in sorted(set(files)) if match(f)]
for f in files:
exact = match.exact(f)
command = ["add"]
@@ -922,11 +922,11 @@
> *.python
> EOF
$ hg add .hgignore
- $ hg add --subrepos "glob:**.python"
+ $ hg add --subrepos "glob:**.python" s/barfoo
adding s/snake.python (glob)
$ hg st --subrepos s
+ A s/barfoo
A s/snake.python
- ? s/barfoo
? s/c.c
? s/cpp.cpp
? s/foobar.orig