Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 10522:b07d487009b2 stable
subrepo: Update .hgsubstate in case of deleted subrepo
When a subrepo is deleted from .hgsub, it also needs to be removed from
.hgsubstate. Previous code was updating .hgsubstate only in case of newly or
modified subrepo.
author | Saint Germain <saintger@gmail.com> |
---|---|
date | Mon, 22 Feb 2010 01:19:59 +0100 |
parents | f75db9927429 |
children | bae9bb09166b |
comparison
equal
deleted
inserted
replaced
10521:bde1bb250fc2 | 10522:b07d487009b2 |
---|---|
785 if force: | 785 if force: |
786 changes[0].extend(changes[6]) # mq may commit unchanged files | 786 changes[0].extend(changes[6]) # mq may commit unchanged files |
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 |
797 if not force and match.files(): | 801 if not force and match.files(): |
798 matched = set(changes[0] + changes[1] + changes[2]) | 802 matched = set(changes[0] + changes[1] + changes[2]) |
828 if editor: | 832 if editor: |
829 cctx._text = editor(self, cctx, subs) | 833 cctx._text = editor(self, cctx, subs) |
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) |
837 sr = wctx.sub(s).commit(cctx._text, user, date) | 841 sr = wctx.sub(s).commit(cctx._text, user, date) |
838 state[s] = (state[s][0], sr) | 842 state[s] = (state[s][0], sr) |