Mercurial > hg
changeset 14481:b2ee161328e0
merge with stable
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 31 May 2011 15:28:23 -0500 |
parents | a21246c7e7d7 (current diff) c63cc5eccbff (diff) |
children | 58b36e9ea783 |
files | mercurial/subrepo.py tests/test-subrepo-git.t |
diffstat | 2 files changed, 37 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/subrepo.py Tue May 31 15:26:02 2011 -0500 +++ b/mercurial/subrepo.py Tue May 31 15:28:23 2011 -0500 @@ -824,7 +824,7 @@ def dirty(self, ignoreupdate=False): if self._gitmissing(): - return True + return self._state[1] != '' if self._gitisbare(): return True if not ignoreupdate and self._state[1] != self._gitstate(): @@ -836,6 +836,9 @@ def get(self, state, overwrite=False): source, revision, kind = state + if not revision: + self.remove() + return self._fetch(source, revision) # if the repo was set to be bare, unbare it if self._gitisbare(): @@ -953,6 +956,8 @@ mergefunc() def push(self, force): + if not self._state[1]: + return True if self._gitmissing(): raise util.Abort(_("subrepo %s is missing") % self._relpath) # if a branch in origin contains the revision, nothing to do @@ -1009,6 +1014,8 @@ def archive(self, ui, archiver, prefix): source, revision = self._state + if not revision: + return self._fetch(source, revision) # Parse git's native archive command. @@ -1033,10 +1040,10 @@ def status(self, rev2, **opts): - if self._gitmissing(): + rev1 = self._state[1] + if self._gitmissing() or not rev1: # if the repo is missing, return no results return [], [], [], [], [], [], [] - rev1 = self._state[1] modified, added, removed = [], [], [] if rev2: command = ['diff-tree', rev1, rev2]
--- a/tests/test-subrepo-git.t Tue May 31 15:26:02 2011 -0500 +++ b/tests/test-subrepo-git.t Tue May 31 15:28:23 2011 -0500 @@ -334,6 +334,33 @@ $ hg sum | grep commit commit: (clean) +Don't crash if the .hgsubstate entry is missing + + $ hg update 1 -q + $ hg rm .hgsubstate + $ hg commit .hgsubstate -m 'no substate' + created new head + $ hg tag -l nosubstate + $ hg manifest + .hgsub + a + + $ hg status -S + $ hg sum | grep commit + commit: 1 subrepos + + $ hg commit -m 'restore substate' + committing subrepository s + $ hg manifest + .hgsub + .hgsubstate + a + $ hg sum | grep commit + commit: (clean) + + $ hg update -qC nosubstate + $ ls s + Check hg update --clean $ cd $TESTTMP/ta $ echo > s/g