Mercurial > public > mercurial-scm > hg
comparison mercurial/subrepo.py @ 13569:3ab3b892d223
subrepo: show the source that git pulls
author | Eric Eisner <ede@mit.edu> |
---|---|
date | Tue, 08 Mar 2011 15:36:56 -0500 |
parents | a2734c8322ac |
children | 31eac42d9123 |
comparison
equal
deleted
inserted
replaced
13568:0b79cf616e65 | 13569:3ab3b892d223 |
---|---|
712 current, err = self._gitdir(['symbolic-ref', 'HEAD', '--quiet']) | 712 current, err = self._gitdir(['symbolic-ref', 'HEAD', '--quiet']) |
713 if err: | 713 if err: |
714 current = None | 714 current = None |
715 return current | 715 return current |
716 | 716 |
717 def _gitremote(self, remote): | |
718 out = self._gitcommand(['remote', 'show', '-n', remote]) | |
719 line = out.split('\n')[1] | |
720 i = line.index('URL: ') + len('URL: ') | |
721 return line[i:] | |
722 | |
717 def _githavelocally(self, revision): | 723 def _githavelocally(self, revision): |
718 out, code = self._gitdir(['cat-file', '-e', revision]) | 724 out, code = self._gitdir(['cat-file', '-e', revision]) |
719 return code == 0 | 725 return code == 0 |
720 | 726 |
721 def _gitisancestor(self, r1, r2): | 727 def _gitisancestor(self, r1, r2): |
766 self._ui.status(_('cloning subrepo %s from %s\n') % | 772 self._ui.status(_('cloning subrepo %s from %s\n') % |
767 (self._relpath, source)) | 773 (self._relpath, source)) |
768 self._gitnodir(['clone', source, self._abspath]) | 774 self._gitnodir(['clone', source, self._abspath]) |
769 if self._githavelocally(revision): | 775 if self._githavelocally(revision): |
770 return | 776 return |
771 self._ui.status(_('pulling subrepo %s\n') % self._relpath) | 777 self._ui.status(_('pulling subrepo %s from %s\n') % |
778 (self._relpath, self._gitremote('origin'))) | |
772 # try only origin: the originally cloned repo | 779 # try only origin: the originally cloned repo |
773 self._gitcommand(['fetch']) | 780 self._gitcommand(['fetch']) |
774 if not self._githavelocally(revision): | 781 if not self._githavelocally(revision): |
775 raise util.Abort(_("revision %s does not exist in subrepo %s\n") % | 782 raise util.Abort(_("revision %s does not exist in subrepo %s\n") % |
776 (revision, self._relpath)) | 783 (revision, self._relpath)) |