[PATCH 04/14] [git] Use a new predicate to test if a branch tracks a remote branch
- From: Dirk Wallenstein <halsmit t-online de>
- To: GNOME Desktop Development List <desktop-devel-list gnome org>
- Cc: Frederic Peters <fpeters gnome org>
- Subject: [PATCH 04/14] [git] Use a new predicate to test if a branch tracks a remote branch
- Date: Tue, 18 May 2010 13:12:24 +0200
This allows the remote to have a different name than 'origin', and gives
the operation a meaningful name.
Signed-off-by: Dirk Wallenstein <halsmit t-online de>
---
jhbuild/versioncontrol/git.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index abf9b2c..f2826cd 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -168,6 +168,13 @@ class GitBranch(Branch):
return self._execute_git_predicate(
['git', 'rev-parse', '--is-inside-work-tree'])
+ def _is_tracking_a_remote_branch(self, local_branch):
+ if not local_branch:
+ return False
+ current_branch_remote_config = 'branch.%s.remote' % local_branch
+ return self._execute_git_predicate(
+ ['git', 'config', '--get', current_branch_remote_config])
+
def _check_version_git(self, version_spec):
return check_version(['git', '--version'], r'git version ([\d.]+)',
version_spec, extra_env=get_git_extra_env())
@@ -323,7 +330,7 @@ class GitBranch(Branch):
current_branch = 'master'
# if current branch doesn't exist as origin/$branch it is assumed
# a local work branch, and it won't be changed
- if ('origin/' + current_branch) in self.get_remote_branches_list():
+ if self._is_tracking_a_remote_branch(current_branch):
if self.local_branch_exist(would_be_branch, buildscript):
buildscript.execute(['git', 'checkout', would_be_branch],
**git_extra_args)
--
1.7.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]