Ticket #140: commands.py_2.patch
| File commands.py_2.patch, 2.1 KB (added by amax_snaplogic, 2 years ago) |
|---|
-
buildbot/slave/commands.py
old new 1494 1494 self.command = c 1495 1495 return c.start() 1496 1496 1497 def parseGotRevision(self): 1497 def getSvnVersionCommand(self): 1498 """ 1499 Get the (shell) command used to determine SVN revision number 1500 of checked-out code 1501 1502 return: list of strings, passable as the command argument to ShellCommand 1503 """ 1498 1504 # svn checkout operations finish with 'Checked out revision 16657.' 1499 1505 # svn update operations finish the line 'At revision 16654.' 1500 1506 # But we don't use those. Instead, run 'svnversion'. 1501 1507 svnversion_command = getCommand("svnversion") 1502 1508 # older versions of 'svnversion' (1.1.4) require the WC_PATH 1503 1509 # argument, newer ones (1.3.1) do not. 1504 command = [svnversion_command, "."] 1505 c = ShellCommand(self.builder, command, 1510 return [svnversion_command, "."] 1511 1512 def parseGotRevision(self): 1513 c = ShellCommand(self.builder, 1514 self.getSvnVersionCommand(), 1506 1515 os.path.join(self.builder.basedir, self.srcdir), 1507 1516 environ=self.env, 1508 1517 sendStdout=False, sendStderr=False, sendRC=False, … … 1510 1519 c.usePTY = False 1511 1520 d = c.start() 1512 1521 def _parse(res): 1513 r = c.stdout.strip()1514 # Support for removing svnversion indicator for 'modified'1515 if r[-1] == 'M':1516 r = r[:-1]1522 r_raw = c.stdout.strip() 1523 # Extract revision from the version "number" string 1524 r = r_raw.rstrip('MS') 1525 r = r.split(':')[-1] 1517 1526 got_version = None 1518 1527 try: 1519 1528 got_version = int(r) 1520 1529 except ValueError: 1521 1530 msg =("SVN.parseGotRevision unable to parse output " 1522 "of svnversion: '%s'" % r )1531 "of svnversion: '%s'" % r_raw) 1523 1532 log.msg(msg) 1524 1533 self.sendStatus({'header': msg + "\n"}) 1525 1534 return got_version
![[Buildbot Logo]](/trac/chrome/site/header-text-transparent.png)