mercurial/subrepo.py
branchstable
changeset 14469 2fdea636f254
parent 14205 7b627923739f
child 14481 b2ee161328e0
child 14505 90ef40bf97e3
--- a/mercurial/subrepo.py	Thu May 19 18:09:25 2011 +0200
+++ b/mercurial/subrepo.py	Sat May 28 11:03:48 2011 -0400
@@ -808,7 +808,7 @@
 
     def dirty(self, ignoreupdate=False):
         if self._gitmissing():
-            return True
+            return self._state[1] != ''
         if not ignoreupdate and self._state[1] != self._gitstate():
             # different version checked out
             return True
@@ -818,6 +818,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._gitcommand(['config', '--bool', 'core.bare']) == 'true':
@@ -935,6 +938,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
@@ -991,6 +996,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.
@@ -1015,10 +1022,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]