import sys
import logging
import bb
+import re
from bb import data
from bb.fetch2 import FetchMethod
from bb.fetch2 import FetchError
if command == "info":
svncmd = "%s info %s %s://%s/%s/" % (ud.basecmd, " ".join(options), proto, svnroot, ud.module)
+ elif command == "log1":
+ svncmd = "%s log --limit 1 %s %s://%s/%s/" % (ud.basecmd, " ".join(options), proto, svnroot, ud.module)
else:
suffix = ""
if ud.revision:
"""
Return the latest upstream revision number
"""
- bb.fetch2.check_network_access(d, self._buildsvncommand(ud, d, "info"))
+ bb.fetch2.check_network_access(d, self._buildsvncommand(ud, d, "log1"))
- output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "info"), d, True)
+ output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "log1"), d, True)
- revision = None
- for line in output.splitlines():
- if "Last Changed Rev" in line:
- revision = line.split(":")[1].strip()
+ # skip the first line, as per output of svn log
+ # then we expect the revision on the 2nd line
+ revision = re.search('^r([0-9]*)', output.splitlines()[1]).group(1)
return revision