comparison mercurial/subrepo.py @ 39547:41ac8ea1bdd7 stable

subrepo: mask out passwords embedded in the messages displaying a URL I noticed the password in maintenance logs for the "no changes since last push" and "pushing to" messages when pushing with an explicit path. But the test case here with :pushurl was also affected. I didn't see that cloning or pulling subrepos on demand had this problem, but it seems safer to just mask that too. There's a bit of a disconnect here, because it looks like clone is slicing off the password (makes sense not to store it in the hgrc in cleartext). But not shearing it off of an explicit path causes the subrepo not to realize that it already pushed the latest stuff. This is the easiest fix, however.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 11 Sep 2018 13:52:17 -0400
parents 760cc5dc01e8
children c31ce080eb75
comparison
equal deleted inserted replaced
39455:6af7765bdb7c 39547:41ac8ea1bdd7
653 } 653 }
654 else: 654 else:
655 shareopts = {} 655 shareopts = {}
656 656
657 self.ui.status(_('cloning subrepo %s from %s\n') 657 self.ui.status(_('cloning subrepo %s from %s\n')
658 % (subrelpath(self), srcurl)) 658 % (subrelpath(self), util.hidepassword(srcurl)))
659 other, cloned = hg.clone(self._repo._subparent.baseui, {}, 659 other, cloned = hg.clone(self._repo._subparent.baseui, {},
660 other, self._repo.root, 660 other, self._repo.root,
661 update=False, shareopts=shareopts) 661 update=False, shareopts=shareopts)
662 self._repo = cloned.local() 662 self._repo = cloned.local()
663 self._initrepo(parentrepo, source, create=True) 663 self._initrepo(parentrepo, source, create=True)
664 self._cachestorehash(srcurl) 664 self._cachestorehash(srcurl)
665 else: 665 else:
666 self.ui.status(_('pulling subrepo %s from %s\n') 666 self.ui.status(_('pulling subrepo %s from %s\n')
667 % (subrelpath(self), srcurl)) 667 % (subrelpath(self), util.hidepassword(srcurl)))
668 cleansub = self.storeclean(srcurl) 668 cleansub = self.storeclean(srcurl)
669 exchange.pull(self._repo, other) 669 exchange.pull(self._repo, other)
670 if cleansub: 670 if cleansub:
671 # keep the repo clean after pull 671 # keep the repo clean after pull
672 self._cachestorehash(srcurl) 672 self._cachestorehash(srcurl)
733 dsturl = _abssource(self._repo, True) 733 dsturl = _abssource(self._repo, True)
734 if not force: 734 if not force:
735 if self.storeclean(dsturl): 735 if self.storeclean(dsturl):
736 self.ui.status( 736 self.ui.status(
737 _('no changes made to subrepo %s since last push to %s\n') 737 _('no changes made to subrepo %s since last push to %s\n')
738 % (subrelpath(self), dsturl)) 738 % (subrelpath(self), util.hidepassword(dsturl)))
739 return None 739 return None
740 self.ui.status(_('pushing subrepo %s to %s\n') % 740 self.ui.status(_('pushing subrepo %s to %s\n') %
741 (subrelpath(self), dsturl)) 741 (subrelpath(self), util.hidepassword(dsturl)))
742 other = hg.peer(self._repo, {'ssh': ssh}, dsturl) 742 other = hg.peer(self._repo, {'ssh': ssh}, dsturl)
743 res = exchange.push(self._repo, other, force, newbranch=newbranch) 743 res = exchange.push(self._repo, other, force, newbranch=newbranch)
744 744
745 # the repo is now clean 745 # the repo is now clean
746 self._cachestorehash(dsturl) 746 self._cachestorehash(dsturl)