jhbuild r2130 - in trunk: . jhbuild/versioncontrol
- From: jsharpe svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r2130 - in trunk: . jhbuild/versioncontrol
- Date: Sat, 7 Jun 2008 17:21:49 +0000 (UTC)
Author: jsharpe
Date: Sat Jun 7 17:21:49 2008
New Revision: 2130
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2130&view=rev
Log:
2008-07-04 James Sharpe <jsharpe svn gnome org>
* jhbuild/versioncontrol/git.py: Added fallback to git-svn
show-externals for when unhandled.log doesn't exist.
Modified:
trunk/ChangeLog
trunk/jhbuild/versioncontrol/git.py
Modified: trunk/jhbuild/versioncontrol/git.py
==============================================================================
--- trunk/jhbuild/versioncontrol/git.py (original)
+++ trunk/jhbuild/versioncontrol/git.py Sat Jun 7 17:21:49 2008
@@ -241,21 +241,38 @@
def _get_externals(self, buildscript, branch="git-svn"):
cwd = self.get_checkoutdir()
- unhandledFile = open(cwd + os.path.join(os.sep, '.git', 'svn', branch, 'unhandled.log'), 'r')
- external_expr = re.compile(r"\+dir_prop: (.*?) svn:externals (.*)$")
- rev_expr = re.compile(r"^r(\d+)$")
- externals = {}
- match = None
- #the unhandled.log file has the revision numbers
- #encoded as r#num we should only parse as far as self.revision
- for line in unhandledFile:
- m = external_expr.search(line)
- if m:
- match = m
- rev_match = rev_expr.search(line)
- if self.revision and rev_match:
- if rev_match.group(1) > self.revision:
- break
+ try:
+ externals = {}
+ match = None
+ unhandledFile = open(cwd + os.path.join(os.sep, '.git', 'svn', branch, 'unhandled.log'), 'r')
+ external_expr = re.compile(r"\+dir_prop: (.*?) svn:externals (.*)$")
+ rev_expr = re.compile(r"^r(\d+)$")
+ #the unhandled.log file has the revision numbers
+ #encoded as r#num we should only parse as far as self.revision
+ for line in unhandledFile:
+ m = external_expr.search(line)
+ if m:
+ match = m
+ rev_match = rev_expr.search(line)
+ if self.revision and rev_match:
+ if rev_match.group(1) > self.revision:
+ break
+
+ except IOError:
+ #we couldn't find an unhandled.log to parse so try
+ #git-svn show-externals - note this is broken in git < 1.5.6
+ try:
+ output = get_output(['git-svn', 'show-externals'], cwd=cwd)
+ #we search for comment lines to strip them out
+ comment_line = re.compile(r"^#.*")
+ ext = ''
+ for line in output.splitlines():
+ if not comment_line.search(line):
+ ext += ' ' + line
+
+ match = re.compile("^(\.) (.+)").search(". " + ext)
+ except OSError:
+ raise FatalError(_("External handling failed\n If you are running git version < 1.5.6 it is recommended you update.\n"))
#only parse the final match
if match:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]