##// END OF EJS Templates
subrepo: strip gitcommand output
Eric Eisner -
r13085:b4814f1f default
parent child Browse files
Show More
@@ -638,7 +638,7 b' class gitsubrepo(object):'
638 638 if stream:
639 639 return p.stdout, None
640 640
641 retdata = p.stdout.read()
641 retdata = p.stdout.read().strip()
642 642 # wait for the child to exit to avoid race condition.
643 643 p.wait()
644 644
@@ -659,14 +659,14 b' class gitsubrepo(object):'
659 659 return retdata, p.returncode
660 660
661 661 def _gitstate(self):
662 return self._gitcommand(['rev-parse', 'HEAD']).strip()
662 return self._gitcommand(['rev-parse', 'HEAD'])
663 663
664 664 def _githavelocally(self, revision):
665 665 out, code = self._gitdir(['cat-file', '-e', revision])
666 666 return code == 0
667 667
668 668 def _gitisancestor(self, r1, r2):
669 base = self._gitcommand(['merge-base', r1, r2]).strip()
669 base = self._gitcommand(['merge-base', r1, r2])
670 670 return base == r1
671 671
672 672 def _gitbranchmap(self):
@@ -677,8 +677,6 b' class gitsubrepo(object):'
677 677 out = self._gitcommand(['branch', '-a', '--no-color',
678 678 '--verbose', '--abbrev=40'])
679 679 for line in out.split('\n'):
680 if not line:
681 continue
682 680 if line[2:].startswith('(no branch)'):
683 681 continue
684 682 branch, revision = line[2:].split()[:2]
@@ -708,14 +706,13 b' class gitsubrepo(object):'
708 706 # docs say --porcelain flag is future-proof format
709 707 changed = self._gitcommand(['status', '--porcelain',
710 708 '--untracked-files=no'])
711 return bool(changed.strip())
709 return bool(changed)
712 710
713 711 def get(self, state):
714 712 source, revision, kind = state
715 713 self._fetch(source, revision)
716 714 # if the repo was set to be bare, unbare it
717 if self._gitcommand(['config', '--get', 'core.bare']
718 ).strip() == 'true':
715 if self._gitcommand(['config', '--bool', 'core.bare']) == 'true':
719 716 self._gitcommand(['config', 'core.bare', 'false'])
720 717 if self._gitstate() == revision:
721 718 self._gitcommand(['reset', '--hard', 'HEAD'])
@@ -763,8 +760,7 b' class gitsubrepo(object):'
763 760 def merge(self, state):
764 761 source, revision, kind = state
765 762 self._fetch(source, revision)
766 base = self._gitcommand(['merge-base', revision,
767 self._state[1]]).strip()
763 base = self._gitcommand(['merge-base', revision, self._state[1]])
768 764 if base == revision:
769 765 self.get(state) # fast forward merge
770 766 elif base != self._state[1]:
General Comments 0
You need to be logged in to leave comments. Login now