comparison mercurial/subrepo.py @ 20319:427d672c0e4e stable

subrepo: make it possible to update to hidden subrepo revisions When a subrepo revision was hidden it was considered missing and mercurial was unable to update to the corresponding parent revision. Instead warn the user of the problem and let it choose what to do (the default is to udpate anyway).
author Angel Ezquerra <angel.ezquerra@gmail.com>
date Sun, 24 Nov 2013 02:17:17 +0100
parents c5aef7a66607
children d4f804caa0ed 6a2acb0d9352
comparison
equal deleted inserted replaced
20318:c5aef7a66607 20319:427d672c0e4e
700 hg.clean(self._repo, node.nullid, False) 700 hg.clean(self._repo, node.nullid, False)
701 701
702 def _get(self, state): 702 def _get(self, state):
703 source, revision, kind = state 703 source, revision, kind = state
704 if revision in self._repo.unfiltered(): 704 if revision in self._repo.unfiltered():
705 return 705 return True
706 self._repo._subsource = source 706 self._repo._subsource = source
707 srcurl = _abssource(self._repo) 707 srcurl = _abssource(self._repo)
708 other = hg.peer(self._repo, {}, srcurl) 708 other = hg.peer(self._repo, {}, srcurl)
709 if len(self._repo) == 0: 709 if len(self._repo) == 0:
710 self._repo.ui.status(_('cloning subrepo %s from %s\n') 710 self._repo.ui.status(_('cloning subrepo %s from %s\n')
726 bookmarks.updatefromremote(self._repo.ui, self._repo, 726 bookmarks.updatefromremote(self._repo.ui, self._repo,
727 remotebookmarks, srcurl) 727 remotebookmarks, srcurl)
728 if cleansub: 728 if cleansub:
729 # keep the repo clean after pull 729 # keep the repo clean after pull
730 self._cachestorehash(srcurl) 730 self._cachestorehash(srcurl)
731 return False
731 732
732 @annotatesubrepoerror 733 @annotatesubrepoerror
733 def get(self, state, overwrite=False): 734 def get(self, state, overwrite=False):
734 self._get(state) 735 inrepo = self._get(state)
735 source, revision, kind = state 736 source, revision, kind = state
736 self._repo.ui.debug("getting subrepo %s\n" % self._path) 737 repo = self._repo
737 hg.updaterepo(self._repo, revision, overwrite) 738 repo.ui.debug("getting subrepo %s\n" % self._path)
739 if inrepo:
740 urepo = repo.unfiltered()
741 ctx = urepo[revision]
742 if ctx.hidden():
743 urepo.ui.warn(
744 _('revision %s in subrepo %s is hidden\n') \
745 % (revision[0:12], self._path))
746 repo = urepo
747 hg.updaterepo(repo, revision, overwrite)
738 748
739 @annotatesubrepoerror 749 @annotatesubrepoerror
740 def merge(self, state): 750 def merge(self, state):
741 self._get(state) 751 self._get(state)
742 cur = self._repo['.'] 752 cur = self._repo['.']