Show More
@@ -824,7 +824,7 class gitsubrepo(abstractsubrepo): | |||||
824 |
|
824 | |||
825 | def dirty(self, ignoreupdate=False): |
|
825 | def dirty(self, ignoreupdate=False): | |
826 | if self._gitmissing(): |
|
826 | if self._gitmissing(): | |
827 |
return |
|
827 | return self._state[1] != '' | |
828 | if self._gitisbare(): |
|
828 | if self._gitisbare(): | |
829 | return True |
|
829 | return True | |
830 | if not ignoreupdate and self._state[1] != self._gitstate(): |
|
830 | if not ignoreupdate and self._state[1] != self._gitstate(): | |
@@ -836,6 +836,9 class gitsubrepo(abstractsubrepo): | |||||
836 |
|
836 | |||
837 | def get(self, state, overwrite=False): |
|
837 | def get(self, state, overwrite=False): | |
838 | source, revision, kind = state |
|
838 | source, revision, kind = state | |
|
839 | if not revision: | |||
|
840 | self.remove() | |||
|
841 | return | |||
839 | self._fetch(source, revision) |
|
842 | self._fetch(source, revision) | |
840 | # if the repo was set to be bare, unbare it |
|
843 | # if the repo was set to be bare, unbare it | |
841 | if self._gitisbare(): |
|
844 | if self._gitisbare(): | |
@@ -953,6 +956,8 class gitsubrepo(abstractsubrepo): | |||||
953 | mergefunc() |
|
956 | mergefunc() | |
954 |
|
957 | |||
955 | def push(self, force): |
|
958 | def push(self, force): | |
|
959 | if not self._state[1]: | |||
|
960 | return True | |||
956 | if self._gitmissing(): |
|
961 | if self._gitmissing(): | |
957 | raise util.Abort(_("subrepo %s is missing") % self._relpath) |
|
962 | raise util.Abort(_("subrepo %s is missing") % self._relpath) | |
958 | # if a branch in origin contains the revision, nothing to do |
|
963 | # if a branch in origin contains the revision, nothing to do | |
@@ -1009,6 +1014,8 class gitsubrepo(abstractsubrepo): | |||||
1009 |
|
1014 | |||
1010 | def archive(self, ui, archiver, prefix): |
|
1015 | def archive(self, ui, archiver, prefix): | |
1011 | source, revision = self._state |
|
1016 | source, revision = self._state | |
|
1017 | if not revision: | |||
|
1018 | return | |||
1012 | self._fetch(source, revision) |
|
1019 | self._fetch(source, revision) | |
1013 |
|
1020 | |||
1014 | # Parse git's native archive command. |
|
1021 | # Parse git's native archive command. | |
@@ -1033,10 +1040,10 class gitsubrepo(abstractsubrepo): | |||||
1033 |
|
1040 | |||
1034 |
|
1041 | |||
1035 | def status(self, rev2, **opts): |
|
1042 | def status(self, rev2, **opts): | |
1036 | if self._gitmissing(): |
|
1043 | rev1 = self._state[1] | |
|
1044 | if self._gitmissing() or not rev1: | |||
1037 | # if the repo is missing, return no results |
|
1045 | # if the repo is missing, return no results | |
1038 | return [], [], [], [], [], [], [] |
|
1046 | return [], [], [], [], [], [], [] | |
1039 | rev1 = self._state[1] |
|
|||
1040 | modified, added, removed = [], [], [] |
|
1047 | modified, added, removed = [], [], [] | |
1041 | if rev2: |
|
1048 | if rev2: | |
1042 | command = ['diff-tree', rev1, rev2] |
|
1049 | command = ['diff-tree', rev1, rev2] |
@@ -334,6 +334,33 Don't crash if the subrepo is missing | |||||
334 | $ hg sum | grep commit |
|
334 | $ hg sum | grep commit | |
335 | commit: (clean) |
|
335 | commit: (clean) | |
336 |
|
336 | |||
|
337 | Don't crash if the .hgsubstate entry is missing | |||
|
338 | ||||
|
339 | $ hg update 1 -q | |||
|
340 | $ hg rm .hgsubstate | |||
|
341 | $ hg commit .hgsubstate -m 'no substate' | |||
|
342 | created new head | |||
|
343 | $ hg tag -l nosubstate | |||
|
344 | $ hg manifest | |||
|
345 | .hgsub | |||
|
346 | a | |||
|
347 | ||||
|
348 | $ hg status -S | |||
|
349 | $ hg sum | grep commit | |||
|
350 | commit: 1 subrepos | |||
|
351 | ||||
|
352 | $ hg commit -m 'restore substate' | |||
|
353 | committing subrepository s | |||
|
354 | $ hg manifest | |||
|
355 | .hgsub | |||
|
356 | .hgsubstate | |||
|
357 | a | |||
|
358 | $ hg sum | grep commit | |||
|
359 | commit: (clean) | |||
|
360 | ||||
|
361 | $ hg update -qC nosubstate | |||
|
362 | $ ls s | |||
|
363 | ||||
337 | Check hg update --clean |
|
364 | Check hg update --clean | |
338 | $ cd $TESTTMP/ta |
|
365 | $ cd $TESTTMP/ta | |
339 | $ echo > s/g |
|
366 | $ echo > s/g |
General Comments 0
You need to be logged in to leave comments.
Login now