Skip to content

Commit

Permalink
MercurialExtractor: fall back to working directory diff if no upstrea…
Browse files Browse the repository at this point in the history
…m is configured
  • Loading branch information
bcully committed May 9, 2013
1 parent 79be0cb commit c4fef03
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions master/buildbot/clients/tryclient.py
Expand Up @@ -194,15 +194,21 @@ def _didvc(self, res, cmd):

return stdout

@defer.inlineCallbacks
def getBaseRevision(self):
upstream = ""
if self.repository:
upstream = "r'%s'" % self.repository
d = self.dovc(["log", "--template", "{node}\\n", "-r", "max(::. - outgoing(%s))" % upstream])
d.addCallback(self.parseStatus)
return d

def parseStatus(self, output):
output = ''
try:
output = yield self.dovc(["log", "--template", "{node}\\n", "-r",
"max(::. - outgoing(%s))" % upstream])
except RuntimeError:
# outgoing() will abort if no default-push/default path is configured
if upstream:
raise
# fall back to current working directory parent
output = yield self.dovc(["log", "--template", "{node}\\n", "-r", "p1()"])
m = re.search(r'^(\w+)', output)
if not m:
raise RuntimeError("Revision %r is not in the right format" % (output,))
Expand Down

0 comments on commit c4fef03

Please sign in to comment.