Ticket #128: monotone_user_support-unified.diff

File monotone_user_support-unified.diff, 4.5 KB (added by grim, 22 months ago)

applied cleanly against darcs head, this one *IS* unified

  • buildbot/changes/monotone.py

    diff -rN -u old-buildbot/buildbot/changes/monotone.py new-buildbot/buildbot/changes/monotone.py
    old new  
    3636class Monotone: 
    3737    """All methods of this class return a Deferred.""" 
    3838 
    39     def __init__(self, bin, db): 
     39    def __init__(self, bin, db, user): 
    4040        self.bin = bin 
    4141        self.db = db 
     42        self.user = user 
    4243 
    4344    def _run_monotone(self, args): 
    4445        d = defer.Deferred() 
    4546        cmdline = (self.bin, "--db=" + self.db) + tuple(args) 
     47        if self.user: 
     48                cmdline += ('-k'+self.user,)  #add user if provided, note comma at end to form tuple 
    4649        p = _MTProtocol(d, cmdline) 
    4750        log.msg("Running command: %r" % (cmdline,)) 
    4851        log.msg("wd: %s" % os.getcwd()) 
     
    137140    volatile = ["loop", "d", "tmpfile", "monotone"] 
    138141 
    139142    def __init__(self, server_addr, branch, trusted_keys, db_path, 
    140                  pollinterval=60 * 10, monotone_exec="monotone"): 
     143                 pollinterval=60 * 10, monotone_exec="monotone",user=None): 
    141144        self.server_addr = server_addr 
    142145        self.branch = branch 
    143146        self.trusted_keys = trusted_keys 
    144147        self.db_path = db_path 
    145148        self.pollinterval = pollinterval 
    146149        self.monotone_exec = monotone_exec 
    147         self.monotone = Monotone(self.monotone_exec, self.db_path) 
     150        self.monotone = Monotone(self.monotone_exec, self.db_path, user) 
    148151 
    149152    def startService(self): 
    150153        self.loop = LoopingCall(self.start_poll) 
  • buildbot/slave/commands.py

    diff -rN -u old-buildbot/buildbot/slave/commands.py new-buildbot/buildbot/slave/commands.py
    old new  
    16301630 
    16311631    def setup(self, args): 
    16321632        SourceBase.setup(self, args) 
     1633        self.user = None 
     1634        self.password = None 
     1635         
     1636        #add username / pass support 
     1637        if args.has_key('user'): 
     1638                self.user = args['user'] 
     1639        if args.has_key('password'): 
     1640                self.password = args['password'] 
    16331641        self.vcexe = getCommand("darcs") 
    16341642        self.repourl = args['repourl'] 
    16351643        self.sourcedata = "%s\n" % self.repourl 
     
    16541662                         sendRC=False, timeout=self.timeout) 
    16551663        self.command = c 
    16561664        return c.start() 
     1665        if self.user: 
     1666                command.append('-k'+self.user) 
    16571667 
    16581668    def doVCFull(self): 
    16591669        # checkout or export 
     
    16681678            f.close() 
    16691679            # tell Darcs to use that context 
    16701680            command.append('--context') 
     1681        if self.user: 
     1682                command.append('-k'+self.user) 
    16711683            command.append(n) 
    16721684        command.append(self.repourl) 
    16731685 
     
    16891701        c = ShellCommand(self.builder, command, 
    16901702                         os.path.join(self.builder.basedir, self.srcdir), 
    16911703                         environ=self.env, 
     1704        if self.user: 
     1705                command.append('-k'+self.user)                
    16921706                         sendStdout=False, sendStderr=False, sendRC=False, 
    16931707                         keepStdout=True) 
    16941708        c.usePTY = False 
     
    17011715class Monotone(SourceBase): 
    17021716    """Monotone-specific VC operation.  In addition to the arguments handled 
    17031717    by SourceBase, this command reads the following keys: 
     1718        if self.user: 
     1719                command.append('-k'+self.user) 
    17041720 
    17051721    ['server_addr'] (required): the address of the server to pull from 
    17061722    ['branch'] (required): the branch the revision is on 
  • buildbot/steps/source.py

    diff -rN -u old-buildbot/buildbot/steps/source.py new-buildbot/buildbot/steps/source.py
    old new  
    10501050    name = "monotone" 
    10511051 
    10521052    def __init__(self, server_addr, branch, db_path="monotone.db", 
    1053                  monotone="monotone", 
     1053                 monotone="monotone", user=None, 
    10541054                 **kwargs): 
    10551055        Source.__init__(self, **kwargs) 
    10561056        self.addFactoryArguments(server_addr=server_addr, 
     
    10611061        self.args.update({"server_addr": server_addr, 
    10621062                          "branch": branch, 
    10631063                          "db_path": db_path, 
    1064                           "monotone": monotone}) 
     1064                          "monotone": monotone, 
     1065                          "user":user}) 
    10651066 
    10661067    def computeSourceRevision(self, changes): 
    10671068        if not changes: