Mercurial > hg
comparison mercurial/subrepo.py @ 20318:c5aef7a66607 stable
subrepo: remove unnecessary else clause in hgsubrepo._get
This revision has no behaviour change. It simply removes an unnecessary else
that follows an if / return block. The change looks big because a big chunk of
code has been unindented one level.
author | Angel Ezquerra <angel.ezquerra@gmail.com> |
---|---|
date | Sun, 24 Nov 2013 02:13:00 +0100 |
parents | d6939f29b3b3 |
children | 427d672c0e4e |
comparison
equal
deleted
inserted
replaced
20317:d6939f29b3b3 | 20318:c5aef7a66607 |
---|---|
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 |
706 self._repo._subsource = source | |
707 srcurl = _abssource(self._repo) | |
708 other = hg.peer(self._repo, {}, srcurl) | |
709 if len(self._repo) == 0: | |
710 self._repo.ui.status(_('cloning subrepo %s from %s\n') | |
711 % (subrelpath(self), srcurl)) | |
712 parentrepo = self._repo._subparent | |
713 shutil.rmtree(self._repo.path) | |
714 other, cloned = hg.clone(self._repo._subparent.baseui, {}, | |
715 other, self._repo.root, | |
716 update=False) | |
717 self._repo = cloned.local() | |
718 self._initrepo(parentrepo, source, create=True) | |
719 self._cachestorehash(srcurl) | |
706 else: | 720 else: |
707 self._repo._subsource = source | 721 self._repo.ui.status(_('pulling subrepo %s from %s\n') |
708 srcurl = _abssource(self._repo) | 722 % (subrelpath(self), srcurl)) |
709 other = hg.peer(self._repo, {}, srcurl) | 723 cleansub = self.storeclean(srcurl) |
710 if len(self._repo) == 0: | 724 remotebookmarks = other.listkeys('bookmarks') |
711 self._repo.ui.status(_('cloning subrepo %s from %s\n') | 725 self._repo.pull(other) |
712 % (subrelpath(self), srcurl)) | 726 bookmarks.updatefromremote(self._repo.ui, self._repo, |
713 parentrepo = self._repo._subparent | 727 remotebookmarks, srcurl) |
714 shutil.rmtree(self._repo.path) | 728 if cleansub: |
715 other, cloned = hg.clone(self._repo._subparent.baseui, {}, | 729 # keep the repo clean after pull |
716 other, self._repo.root, | |
717 update=False) | |
718 self._repo = cloned.local() | |
719 self._initrepo(parentrepo, source, create=True) | |
720 self._cachestorehash(srcurl) | 730 self._cachestorehash(srcurl) |
721 else: | |
722 self._repo.ui.status(_('pulling subrepo %s from %s\n') | |
723 % (subrelpath(self), srcurl)) | |
724 cleansub = self.storeclean(srcurl) | |
725 remotebookmarks = other.listkeys('bookmarks') | |
726 self._repo.pull(other) | |
727 bookmarks.updatefromremote(self._repo.ui, self._repo, | |
728 remotebookmarks, srcurl) | |
729 if cleansub: | |
730 # keep the repo clean after pull | |
731 self._cachestorehash(srcurl) | |
732 | 731 |
733 @annotatesubrepoerror | 732 @annotatesubrepoerror |
734 def get(self, state, overwrite=False): | 733 def get(self, state, overwrite=False): |
735 self._get(state) | 734 self._get(state) |
736 source, revision, kind = state | 735 source, revision, kind = state |