[Buildbot-commits] [SPAM] Re: [Buildbot] #640: Mercurial always clobbers if repo-url contains password

Buildbot buildbot-devel at lists.sourceforge.net
Sun Dec 27 16:43:18 UTC 2009


#640: Mercurial always clobbers if repo-url contains password
---------------------+------------------------------------------------------
Reporter:  miltondp  |        Owner:       
    Type:  defect    |       Status:  new  
Priority:  critical  |    Milestone:  0.8.+
 Version:  0.7.11    |   Resolution:       
Keywords:            |  
---------------------+------------------------------------------------------

Comment(by marcusl):

 How about this:

 {{{
 #!diff
 diff --git a/buildbot/slave/commands.py b/buildbot/slave/commands.py
 index 69fb37c..c9b8184 100755
 --- a/buildbot/slave/commands.py
 +++ b/buildbot/slave/commands.py
 @@ -2799,6 +2799,22 @@ class Mercurial(SourceBase):
                  else:
                      repourl = self.repourl

 +                def _remove_userpassword(url):
 +                    if '@' not in url:
 +                        return url
 +
 +                    from urlparse import urlparse
 +                    p = urlparse(url)
 +                    netloc = p[1].split('@')
 +
 +                    if len(netloc) > 1:
 +                        return p[0] + '://' + netloc[1] + p[2]
 +                    else:
 +                        return p[0] + '://' + p[1]
 +
 +                oldurl = _remove_userpassword(oldurl)
 +                repourl = _remove_userpassword(repourl)
 +
                  if oldurl != repourl:
                      self.clobber = self._clobber
                      msg = "RepoURL changed from '%s' in wc to '%s' in
 update. Clobbering" % (oldurl, repourl)
 }}}

-- 
Ticket URL: <http://buildbot.net/trac/ticket/640#comment:8>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list