##// END OF EJS Templates
subrepos: support adding files in git subrepos...
Mathias De Maré -
r24174:bd9f64ec default
parent child Browse files
Show More
@@ -78,7 +78,7 b' Interaction with Mercurial Commands'
78 78 :add: add does not recurse in subrepos unless -S/--subrepos is
79 79 specified. However, if you specify the full path of a file in a
80 80 subrepo, it will be added even without -S/--subrepos specified.
81 Git and Subversion subrepositories are currently silently
81 Subversion subrepositories are currently silently
82 82 ignored.
83 83
84 84 :addremove: addremove does not recurse into subrepos unless
@@ -1523,6 +1523,29 b' class gitsubrepo(abstractsubrepo):'
1523 1523 return False
1524 1524
1525 1525 @annotatesubrepoerror
1526 def add(self, ui, match, prefix, explicitonly, **opts):
1527 if self._gitmissing():
1528 return []
1529 if match.files():
1530 files = match.files()
1531 else:
1532 (modified, added, removed,
1533 deleted, unknown, ignored, clean) = self.status(None)
1534 files = unknown
1535
1536 files = [f for f in files if match(f)]
1537 for f in files:
1538 exact = match.exact(f)
1539 command = ["add"]
1540 if exact:
1541 command.append("-f") #should be added, even if ignored
1542 if ui.verbose or not exact:
1543 ui.status(_('adding %s\n') % match.rel(f))
1544 if not opts.get('dry_run'):
1545 self._gitcommand(command + [f])
1546 return []
1547
1548 @annotatesubrepoerror
1526 1549 def remove(self):
1527 1550 if self._gitmissing():
1528 1551 return
@@ -134,6 +134,7 b' clone root separately, make different lo'
134 134 $ hg status --subrepos
135 135 ? s/f
136 136 $ hg add .
137 adding f
137 138 $ git add f
138 139 $ cd ..
139 140
@@ -850,4 +851,130 b' show file at specific revision'
850 851 $ hg cat -r "parents(.)" --output tmp/%b/foobar s/foobar
851 852 $ diff tmp/tc/foobar catparents
852 853
854 cleanup
855 $ rm -r tmp
856 $ rm catparents
857
858 add git files, using either files or patterns
859 $ echo "hsss! hsssssssh!" > s/snake.python
860 $ echo "ccc" > s/c.c
861 $ echo "cpp" > s/cpp.cpp
862
863 $ hg add s/snake.python s/c.c s/cpp.cpp
864 $ hg st --subrepos s
865 M s/foobar
866 A s/c.c
867 A s/cpp.cpp
868 A s/snake.python
869 ? s/barfoo
870 $ hg revert s
871 reverting subrepo ../gitroot
872
873 $ hg add --subrepos "glob:**.python"
874 adding s/snake.python (glob)
875 $ hg st --subrepos s
876 A s/snake.python
877 ? s/barfoo
878 ? s/c.c
879 ? s/cpp.cpp
880 ? s/foobar.orig
881 $ hg revert s
882 reverting subrepo ../gitroot
883
884 $ hg add --subrepos s
885 adding s/barfoo (glob)
886 adding s/c.c (glob)
887 adding s/cpp.cpp (glob)
888 adding s/foobar.orig (glob)
889 adding s/snake.python (glob)
890 $ hg st --subrepos s
891 A s/barfoo
892 A s/c.c
893 A s/cpp.cpp
894 A s/foobar.orig
895 A s/snake.python
896 $ hg revert s
897 reverting subrepo ../gitroot
898 make sure everything is reverted correctly
899 $ hg st --subrepos s
900 ? s/barfoo
901 ? s/c.c
902 ? s/cpp.cpp
903 ? s/foobar.orig
904 ? s/snake.python
905
906 $ hg add --subrepos --exclude "path:s/c.c"
907 adding s/barfoo (glob)
908 adding s/cpp.cpp (glob)
909 adding s/foobar.orig (glob)
910 adding s/snake.python (glob)
911 $ hg st --subrepos s
912 A s/barfoo
913 A s/cpp.cpp
914 A s/foobar.orig
915 A s/snake.python
916 ? s/c.c
917 $ hg revert --all -q
918
919 .hgignore should not have influence in subrepos
920 $ cat > .hgignore << EOF
921 > syntax: glob
922 > *.python
923 > EOF
924 $ hg add .hgignore
925 $ hg add --subrepos "glob:**.python"
926 adding s/snake.python (glob)
927 $ hg st --subrepos s
928 A s/snake.python
929 ? s/barfoo
930 ? s/c.c
931 ? s/cpp.cpp
932 ? s/foobar.orig
933 $ hg revert --all -q
934
935 .gitignore should have influence,
936 except for explicitly added files (no patterns)
937 $ cat > s/.gitignore << EOF
938 > *.python
939 > EOF
940 $ hg add s/.gitignore
941 $ hg st --subrepos s
942 A s/.gitignore
943 ? s/barfoo
944 ? s/c.c
945 ? s/cpp.cpp
946 ? s/foobar.orig
947 $ hg add --subrepos "glob:**.python"
948 $ hg st --subrepos s
949 A s/.gitignore
950 ? s/barfoo
951 ? s/c.c
952 ? s/cpp.cpp
953 ? s/foobar.orig
954 $ hg add --subrepos s/snake.python
955 $ hg st --subrepos s
956 A s/.gitignore
957 A s/snake.python
958 ? s/barfoo
959 ? s/c.c
960 ? s/cpp.cpp
961 ? s/foobar.orig
962
963 correctly do a dry run
964 $ hg add --subrepos s --dry-run
965 adding s/barfoo (glob)
966 adding s/c.c (glob)
967 adding s/cpp.cpp (glob)
968 adding s/foobar.orig (glob)
969 $ hg st --subrepos s
970 A s/.gitignore
971 A s/snake.python
972 ? s/barfoo
973 ? s/c.c
974 ? s/cpp.cpp
975 ? s/foobar.orig
976
977 currently no error given when adding an already tracked file
978 $ hg add s/.gitignore
979
853 980 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now