##// END OF EJS Templates
subrepo: Update .hgsubstate in case of deleted subrepo...
Saint Germain -
r10522:b07d4870 stable
parent child Browse files
Show More
@@ -787,10 +787,14 b' class localrepository(repo.repository):'
787
787
788 # check subrepos
788 # check subrepos
789 subs = []
789 subs = []
790 removedsubs = set()
791 for p in wctx.parents():
792 removedsubs.update(s for s in p.substate if match(s))
790 for s in wctx.substate:
793 for s in wctx.substate:
794 removedsubs.discard(s)
791 if match(s) and wctx.sub(s).dirty():
795 if match(s) and wctx.sub(s).dirty():
792 subs.append(s)
796 subs.append(s)
793 if subs and '.hgsubstate' not in changes[0]:
797 if (subs or removedsubs) and '.hgsubstate' not in changes[0]:
794 changes[0].insert(0, '.hgsubstate')
798 changes[0].insert(0, '.hgsubstate')
795
799
796 # make sure all explicit patterns are matched
800 # make sure all explicit patterns are matched
@@ -830,7 +834,7 b' class localrepository(repo.repository):'
830 edited = (text != cctx._text)
834 edited = (text != cctx._text)
831
835
832 # commit subs
836 # commit subs
833 if subs:
837 if subs or removedsubs:
834 state = wctx.substate.copy()
838 state = wctx.substate.copy()
835 for s in subs:
839 for s in subs:
836 self.ui.status(_('committing subrepository %s\n') % s)
840 self.ui.status(_('committing subrepository %s\n') % s)
@@ -162,6 +162,28 b' hg up 5'
162 hg merge 4 # try to merge default into br again
162 hg merge 4 # try to merge default into br again
163 cd ..
163 cd ..
164
164
165 echo % test subrepo delete from .hgsubstate
166 hg init testdelete
167 mkdir testdelete/nested testdelete/nested2
168 hg init testdelete/nested
169 hg init testdelete/nested2
170 echo test > testdelete/nested/foo
171 echo test > testdelete/nested2/foo
172 hg -R testdelete/nested add
173 hg -R testdelete/nested2 add
174 hg -R testdelete/nested ci -m test
175 hg -R testdelete/nested2 ci -m test
176 echo nested = nested > testdelete/.hgsub
177 echo nested2 = nested2 >> testdelete/.hgsub
178 hg -R testdelete add
179 hg -R testdelete ci -m "nested 1 & 2 added"
180 echo nested = nested > testdelete/.hgsub
181 hg -R testdelete ci -m "nested 2 deleted"
182 cat testdelete/.hgsubstate | sed "s:.* ::"
183 hg -R testdelete remove testdelete/.hgsub
184 hg -R testdelete ci -m ".hgsub deleted"
185 cat testdelete/.hgsubstate
186
165 echo % test repository cloning
187 echo % test repository cloning
166 mkdir mercurial mercurial2
188 mkdir mercurial mercurial2
167 hg init nested_absolute
189 hg init nested_absolute
@@ -247,6 +247,13 b' committing subrepository s'
247 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
247 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
248 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
248 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
249 (branch merge, don't forget to commit)
249 (branch merge, don't forget to commit)
250 % test subrepo delete from .hgsubstate
251 adding testdelete/nested/foo
252 adding testdelete/nested2/foo
253 adding testdelete/.hgsub
254 committing subrepository nested2
255 committing subrepository nested
256 nested
250 % test repository cloning
257 % test repository cloning
251 adding nested_absolute/foo
258 adding nested_absolute/foo
252 adding nested_relative/foo2
259 adding nested_relative/foo2
General Comments 0
You need to be logged in to leave comments. Login now