##// END OF EJS Templates
subrepo: basic support for status of git subrepos
Eric Eisner -
r13182:2537bd17 default
parent child Browse files
Show More
@@ -903,6 +903,29 b' class gitsubrepo(abstractsubrepo):'
903 ui.progress(_('archiving (%s)') % relpath, None)
903 ui.progress(_('archiving (%s)') % relpath, None)
904
904
905
905
906 def status(self, rev2, **opts):
907 rev1 = self._state[1]
908 modified, added, removed = [], [], []
909 if rev2:
910 command = ['diff-tree', rev1, rev2]
911 else:
912 command = ['diff-index', rev1]
913 out = self._gitcommand(command)
914 for line in out.split('\n'):
915 tab = line.find('\t')
916 if tab == -1:
917 continue
918 status, f = line[tab - 1], line[tab + 1:]
919 if status == 'M':
920 modified.append(f)
921 elif status == 'A':
922 added.append(f)
923 elif status == 'D':
924 removed.append(f)
925
926 deleted = unknown = ignored = clean = []
927 return modified, added, removed, deleted, unknown, ignored, clean
928
906 types = {
929 types = {
907 'hg': hgsubrepo,
930 'hg': hgsubrepo,
908 'svn': svnsubrepo,
931 'svn': svnsubrepo,
@@ -52,6 +52,8 b' record a new commit from upstream from a'
52 $ git checkout -q -b testing origin/testing >/dev/null
52 $ git checkout -q -b testing origin/testing >/dev/null
53
53
54 $ cd ..
54 $ cd ..
55 $ hg status --subrepos
56 M s/g
55 $ hg commit -m 'update git subrepo'
57 $ hg commit -m 'update git subrepo'
56 committing subrepository s
58 committing subrepository s
57 $ hg debugsub
59 $ hg debugsub
@@ -99,6 +101,8 b' clone root, make local change'
99
101
100 $ cd ../ta
102 $ cd ../ta
101 $ echo ggg >> s/g
103 $ echo ggg >> s/g
104 $ hg status --subrepos
105 M s/g
102 $ hg commit -m ggg
106 $ hg commit -m ggg
103 committing subrepository s
107 committing subrepository s
104 $ hg debugsub
108 $ hg debugsub
@@ -119,6 +123,8 b' clone root separately, make different lo'
119 $ git add f
123 $ git add f
120 $ cd ..
124 $ cd ..
121
125
126 $ hg status --subrepos
127 A s/f
122 $ hg commit -m f
128 $ hg commit -m f
123 committing subrepository s
129 committing subrepository s
124 $ hg debugsub
130 $ hg debugsub
@@ -160,6 +166,10 b' user a pulls, merges, commits'
160 ggg
166 ggg
161 $ hg commit -m 'merge'
167 $ hg commit -m 'merge'
162 committing subrepository s
168 committing subrepository s
169 $ hg status --subrepos --rev 1:5
170 M .hgsubstate
171 M s/g
172 A s/f
163 $ hg debugsub
173 $ hg debugsub
164 path s
174 path s
165 source ../gitroot
175 source ../gitroot
@@ -282,6 +292,8 b' create nested repo'
282 nested commit
292 nested commit
283
293
284 $ echo ffff >> inner/s/f
294 $ echo ffff >> inner/s/f
295 $ hg status --subrepos
296 M inner/s/f
285 $ hg commit -m nested
297 $ hg commit -m nested
286 committing subrepository inner
298 committing subrepository inner
287 committing subrepository inner/s
299 committing subrepository inner/s
General Comments 0
You need to be logged in to leave comments. Login now