Show More
@@ -1530,10 +1530,17 b' class gitsubrepo(abstractsubrepo):' | |||||
1530 | (modified, added, removed, |
|
1530 | (modified, added, removed, | |
1531 | deleted, unknown, ignored, clean) = self.status(None) |
|
1531 | deleted, unknown, ignored, clean) = self.status(None) | |
1532 |
|
1532 | |||
|
1533 | tracked = set() | |||
|
1534 | # dirstates 'amn' warn, 'r' is added again | |||
|
1535 | for l in (modified, added, deleted, clean): | |||
|
1536 | tracked.update(l) | |||
|
1537 | ||||
1533 | # Unknown files not of interest will be rejected by the matcher |
|
1538 | # Unknown files not of interest will be rejected by the matcher | |
1534 | files = unknown |
|
1539 | files = unknown | |
1535 | files.extend(match.files()) |
|
1540 | files.extend(match.files()) | |
1536 |
|
1541 | |||
|
1542 | rejected = [] | |||
|
1543 | ||||
1537 | files = [f for f in sorted(set(files)) if match(f)] |
|
1544 | files = [f for f in sorted(set(files)) if match(f)] | |
1538 | for f in files: |
|
1545 | for f in files: | |
1539 | exact = match.exact(f) |
|
1546 | exact = match.exact(f) | |
@@ -1542,9 +1549,18 b' class gitsubrepo(abstractsubrepo):' | |||||
1542 | command.append("-f") #should be added, even if ignored |
|
1549 | command.append("-f") #should be added, even if ignored | |
1543 | if ui.verbose or not exact: |
|
1550 | if ui.verbose or not exact: | |
1544 | ui.status(_('adding %s\n') % match.rel(f)) |
|
1551 | ui.status(_('adding %s\n') % match.rel(f)) | |
|
1552 | ||||
|
1553 | if f in tracked: # hg prints 'adding' even if already tracked | |||
|
1554 | if exact: | |||
|
1555 | rejected.append(f) | |||
|
1556 | continue | |||
1545 | if not opts.get('dry_run'): |
|
1557 | if not opts.get('dry_run'): | |
1546 | self._gitcommand(command + [f]) |
|
1558 | self._gitcommand(command + [f]) | |
1547 | return [] |
|
1559 | ||
|
1560 | for f in rejected: | |||
|
1561 | ui.warn(_("%s already tracked!\n") % match.abs(f)) | |||
|
1562 | ||||
|
1563 | return rejected | |||
1548 |
|
1564 | |||
1549 | @annotatesubrepoerror |
|
1565 | @annotatesubrepoerror | |
1550 | def remove(self): |
|
1566 | def remove(self): |
@@ -974,7 +974,26 b' correctly do a dry run' | |||||
974 | ? s/cpp.cpp |
|
974 | ? s/cpp.cpp | |
975 | ? s/foobar.orig |
|
975 | ? s/foobar.orig | |
976 |
|
976 | |||
977 |
|
|
977 | error given when adding an already tracked file | |
978 | $ hg add s/.gitignore |
|
978 | $ hg add s/.gitignore | |
|
979 | s/.gitignore already tracked! | |||
|
980 | [1] | |||
|
981 | ||||
|
982 | removed files can be re-added | |||
|
983 | $ hg ci --subrepos -m 'snake' | |||
|
984 | committing subrepository s | |||
|
985 | $ cd s | |||
|
986 | $ git rm snake.python | |||
|
987 | rm 'snake.python' | |||
|
988 | $ touch snake.python | |||
|
989 | $ cd .. | |||
|
990 | $ hg add s/snake.python | |||
|
991 | $ hg status -S | |||
|
992 | M s/snake.python | |||
|
993 | ? .hgignore | |||
|
994 | ? s/barfoo | |||
|
995 | ? s/c.c | |||
|
996 | ? s/cpp.cpp | |||
|
997 | ? s/foobar.orig | |||
979 |
|
998 | |||
980 |
$ |
|
999 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now