jhbuild r1961 - in trunk: . jhbuild/versioncontrol
- From: malureau svn gnome org
- To: svn-commits-list gnome org
- Subject: jhbuild r1961 - in trunk: . jhbuild/versioncontrol
- Date: Thu, 20 Mar 2008 21:50:09 +0000 (GMT)
Author: malureau
Date: Thu Mar 20 21:50:08 2008
New Revision: 1961
URL: http://svn.gnome.org/viewvc/jhbuild?rev=1961&view=rev
Log:
2008-03-20 Marc-Andre Lureau <marcandre lureau gmail com>
* jhbuild/versioncontrol/git.py (GitBranch.branchname): improve
default "branchname" property, by making more guesses.
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 Thu Mar 20 21:50:08 2008
@@ -101,13 +101,21 @@
return os.path.join(self.checkoutroot,
os.path.basename(self.module))
+ def branch_exist(self, branch):
+ if not branch:
+ return False
+ try:
+ get_output(['git-rev-parse', branch], cwd = self.srcdir)
+ return True
+ except:
+ return False
+
def branchname(self):
- if self.tag:
- return self.tag
- elif self.branch:
- return 'origin/' + self.branch
- else:
- return 'origin/master'
+ for b in [self.tag, 'origin/' + str(self.branch), self.branch,
+ 'origin/master', 'origin/trunk', 'master', 'trunk']:
+ if self.branch_exist(b):
+ return b
+ raise
branchname = property(branchname)
def _get_commit_from_date(self):
@@ -210,12 +218,6 @@
GitBranch.__init__(self, repository, module, "", checkoutdir, branch="git-svn")
self.revision = revision
- def branchname(self):
- if (self.branch):
- return self.branch
- return 'git-svn'
- branchname = property(branchname)
-
def _get_externals(self, buildscript):
subdirs = jhbuild.versioncontrol.svn.get_subdirs (self.module)
subdirs.append ('/')
@@ -292,9 +294,10 @@
self.revision = revision
def branchname(self):
- if (self.branch):
- return self.branch
- return 'master'
+ for b in ['remotes/' + str(self.branch), self.branch, 'trunk', 'master']:
+ if self.branch_exist(b):
+ return b
+ raise
branchname = property(branchname)
def _checkout(self, buildscript, copydir=None):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]