jhbuild r2093 - in trunk: . jhbuild/versioncontrol
- From: jsharpe svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r2093 - in trunk: . jhbuild/versioncontrol
- Date: Tue, 13 May 2008 13:25:03 +0100 (BST)
Author: jsharpe
Date: Tue May 13 12:25:02 2008
New Revision: 2093
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2093&view=rev
Log:
2008-05-13 James Sharpe <jsharpe svn gnome org>
* jhbuild/versioncontrol/git.py: Changed the method used to deal
with externals when using git-svn to parse the unhandled.log file
in .git/svn/$branch/ (closes #532675)
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 Tue May 13 12:25:02 2008
@@ -25,6 +25,7 @@
import stat
import urlparse
import subprocess
+import re
from jhbuild.errors import FatalError, CommandError
from jhbuild.utils.cmds import get_output
@@ -235,20 +236,41 @@
GitBranch.__init__(self, repository, module, "", checkoutdir, branch="git-svn")
self.revision = revision
- def _get_externals(self, buildscript):
- subdirs = jhbuild.versioncontrol.svn.get_subdirs (self.module)
- subdirs.append ('/')
- for subdir in subdirs:
- externals = jhbuild.versioncontrol.svn.get_externals (self.module + '/' + subdir)
- for external in externals:
- extdir = self.get_checkoutdir() + os.sep + subdir + os.sep + external
- # fixme: the "right way" is to use submodules
- extbranch = GitSvnBranch(self.repository, externals[external], extdir)
- try:
- os.stat(extdir)[stat.ST_MODE]
- extbranch._update(buildscript)
- except OSError:
- extbranch._checkout(buildscript)
+ 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 (.*)$")
+ externals = {}
+ for line in unhandledFile:
+ match = external_expr.search(line)
+ if match:
+ branch = match.group(1)
+ external = re.compile("%20| ").split(match.group(2).replace("%0A", "%20").strip("%20 "))
+ revision_expr = re.compile(r"-r(\d*)")
+ i = 0
+ print external
+ while i < len(external):
+ #see if we have a revision number
+ match = revision_expr.search(external[i+1])
+ if match:
+ externals[external[i]] = (external[i+2], match.group(1))
+ i = i+3
+ else:
+ externals[external[i]] = (external[i+1], None)
+ i = i+2
+
+ for extdir in externals.iterkeys():
+ uri = externals[extdir][0]
+ revision = externals[extdir][1]
+ extdir = cwd+os.sep+extdir
+ #fixme: the "right way" is to use submodules
+ extbranch = GitSvnBranch(self.repository, uri, extdir, revision)
+
+ try:
+ os.stat(extdir)[stat.ST_MODE]
+ extbranch._update(buildscript)
+ except OSError:
+ extbranch._checkout(buildscript)
def _checkout(self, buildscript, copydir=None):
if self.config.sticky_date:
@@ -279,7 +301,7 @@
pass
#fixme, git-svn should support externals
- self._get_externals(buildscript)
+ self._get_externals(buildscript, self.branch)
def _update(self, buildscript, copydir=None):
if self.config.sticky_date:
@@ -305,7 +327,7 @@
pass
#fixme, git-svn should support externals
- self._get_externals(buildscript)
+ self._get_externals(buildscript, self.branch)
class GitCvsBranch(GitBranch):
def __init__(self, repository, module, checkoutdir, revision=None):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]