[PATCH 13/14] [git] Align local branch predicate with other predicates
- 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 13/14] [git] Align local branch predicate with other predicates
- Date: Tue, 18 May 2010 13:12:33 +0200
There's no need to log the simple test for a local branch. Therefore,
the function can be aligned with the other predicates.
Signed-off-by: Dirk Wallenstein <halsmit t-online de>
---
jhbuild/versioncontrol/git.py | 19 +++++--------------
1 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/jhbuild/versioncontrol/git.py b/jhbuild/versioncontrol/git.py
index 9e0bdc4..7638752 100644
--- a/jhbuild/versioncontrol/git.py
+++ b/jhbuild/versioncontrol/git.py
@@ -136,19 +136,6 @@ class GitBranch(Branch):
return os.path.join(*path_elements)
srcdir = property(srcdir)
- def local_branch_exist(self, branch, buildscript=None):
- try:
- cmd = ['git', 'show-ref', '--quiet', '--verify', 'refs/heads/' + branch]
- if buildscript:
- buildscript.execute(cmd, cwd=self.get_checkoutdir(),
- extra_env=get_git_extra_env())
- else:
- get_output(cmd, cwd=self.get_checkoutdir(),
- extra_env=get_git_extra_env())
- except CommandError:
- return False
- return True
-
def branchname(self):
return self.branch
branchname = property(branchname)
@@ -164,6 +151,10 @@ class GitBranch(Branch):
return False
return True
+ def _is_local_branch(self, branch):
+ return self._execute_git_predicate( ['git', 'show-ref', '--quiet',
+ '--verify', 'refs/heads/' + branch])
+
def _is_inside_work_tree(self):
return self._execute_git_predicate(
['git', 'rev-parse', '--is-inside-work-tree'])
@@ -235,7 +226,7 @@ class GitBranch(Branch):
# If the current branch is not tracking a remote branch it is
# assumed to be a local work branch, and it won't be changed.
if self._is_tracking_a_remote_branch(current_branch):
- if self.local_branch_exist(wanted_branch, buildscript):
+ if self._is_local_branch(wanted_branch):
switch_command = ['git', 'checkout', wanted_branch]
else:
if not self._find_remote_branch_online_if_necessary(
--
1.7.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]