Ticket #181: hgbuildbot.hg10.patch

File hgbuildbot.hg10.patch, 2.4 KB (added by marcusl, 3 years ago)

Patch to make the inrepo-branch patch compile with hg 1.0

  • \buildbot\changes\hgbuildbot.py

    diff -rN -u old-trunk\buildbot\changes\hgbuildbot.py new-trunk\buildbot\changes\hgbuildbot.py
    old new  
    3434import os 
    3535 
    3636from mercurial.i18n import gettext as _ 
    37 from mercurial.node import bin, hex 
     37from mercurial.node import bin, hex, short, nullid 
     38from mercurial.context import workingctx 
     39 
    3840 
    3941# mercurial's on-demand-importing hacks interfere with the: 
    4042#from zope.interface import Interface 
     
    6567            if branchtype == 'dirname': 
    6668                branch = os.path.basename(os.getcwd()) 
    6769            if branchtype == 'inrepo': 
    68                 branch=repo.workingctx().branch() 
     70                branch = workingctx(repo).branch() 
    6971 
    7072    if hooktype == 'changegroup': 
    7173        s = sendchange.Sender(master, None) 
     
    7779            return s.send(c['branch'], c['revision'], c['comments'], 
    7880                          c['files'], c['username']) 
    7981 
    80         node=bin(node) 
     82        node = bin(node) 
    8183        start = repo.changelog.rev(node) 
    82         end = repo.changelog.count() 
     84        end = len(repo.changelog) 
    8385        for rev in xrange(start, end): 
    8486            # send changeset 
    85             n = repo.changelog.node(rev) 
    86             changeset=repo.changelog.read(n) 
     87            node = repo.changelog.node(rev) 
     88            manifest, user, (time, timezone), files, desc, extra = repo.changelog.read(node) 
     89            parents = filter(lambda p: not p == nullid, repo.changelog.parents(node)) 
     90            if len(parents) > 1 and not files: 
     91                files = ["merge"] 
     92             
    8793            change = { 
    8894                'master': master, 
    8995                # note: this is more likely to be a full email address, which 
    9096                # would make the left-hand "Changes" column kind of wide. The 
    9197                # buildmaster should probably be improved to display an 
    9298                # abbreviation of the username. 
    93                 'username': changeset[1], 
    94                 'revision': hex(n), 
    95                 'comments': changeset[4], 
    96                 'files': changeset[3], 
     99                'username': user, 
     100                'revision': hex(node), 
     101                'comments': desc, 
     102                'files': files, 
    97103                'branch': branch 
    98104            } 
    99105            d.addCallback(_send, change)