aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-03-18 11:49:09 +0100
committerGuido Günther <agx@sigxcpu.org>2011-03-18 12:41:42 +0100
commit1ed66ae551020a3da99a23888221168f58276872 (patch)
treea32c85f125973c0aef384322b9848c750c718fed /gbp
parent40f4709668425b03b9f59c28176547c313957715 (diff)
command_wrappers,git: remove unused Git functions
The rest will be moved into gbp.git. Git-Dch: Ignore
Diffstat (limited to 'gbp')
-rw-r--r--gbp/command_wrappers.py50
-rw-r--r--gbp/git.py19
2 files changed, 9 insertions, 60 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py
index 545380c1..1dced063 100644
--- a/gbp/command_wrappers.py
+++ b/gbp/command_wrappers.py
@@ -197,6 +197,7 @@ class GitCommand(Command):
self.run_error = "Couldn't run git %s" % cmd
+# FIXME: move to gbp.git.__init__
class GitInit(GitCommand):
"""Wrap git init"""
def __init__(self):
@@ -204,20 +205,14 @@ class GitInit(GitCommand):
self.run_error = "Couldn't init git repository"
+# FIXME: move to gbp.git.__init__
class GitClone(GitCommand):
"""Wrap git clone"""
def __init__(self):
GitCommand.__init__(self, 'clone')
self.run_error = "Couldn't clone git repository"
-
-class GitShowBranch(GitCommand):
- """Wrap git show-branch"""
- def __init__(self):
- GitCommand.__init__(self, 'branch')
- self.run_error = "Couldn't list branches"
-
-
+# FIXME: move to gbp.git.create_branch
class GitBranch(GitCommand):
"""Wrap git branch"""
def __init__(self):
@@ -231,21 +226,7 @@ class GitBranch(GitCommand):
GitCommand.__call__(self, options)
-class GitCheckoutBranch(GitCommand):
- """Wrap git checkout in order tos switch to a certain branch"""
- def __init__(self, branch):
- GitCommand.__init__(self, 'checkout', [branch])
- self.branch = branch
- self.run_error = 'Couldn\'t switch to branch "%s"' % self.branch
-
-
-class GitPull(GitCommand):
- """Wrap git pull"""
- def __init__(self, repo, branch):
- GitCommand.__init__(self, 'pull', [repo, branch])
- self.run_error = 'Couldn\'t pull "%s" to "%s"' % (branch, repo)
-
-
+# FIXME: move to gbp.git.fetch
class GitFetch(GitCommand):
"""Wrap git fetch"""
def __init__(self, remote = None):
@@ -255,6 +236,7 @@ class GitFetch(GitCommand):
GitCommand.__init__(self, 'fetch', opts)
+# FIXME: move to gbp.git.merge
class GitMerge(GitCommand):
"""Wrap git merge"""
def __init__(self, branch, verbose=False):
@@ -263,6 +245,7 @@ class GitMerge(GitCommand):
self.run_error = 'Couldn\'t merge from "%s"' % (branch,)
+# FIXME: move to gbp.git.create_tag
class GitTag(GitCommand):
"""Wrap git tag"""
def __init__(self, sign_tag=False, keyid=None):
@@ -285,6 +268,7 @@ class GitTag(GitCommand):
GitCommand.__call__(self, cmd)
+# FIXME: move to gbp.git.add
class GitAdd(GitCommand):
"""Wrap git add to add new files"""
def __init__(self, extra_env=None):
@@ -292,26 +276,6 @@ class GitAdd(GitCommand):
self.run_error = "Couldn't add files"
-class GitRm(GitCommand):
- """Wrap git rm to remove files"""
- def __init__(self, verbose=False):
- args = [ ['--quiet'], [] ][verbose]
- GitCommand.__init__(self, cmd='rm', args=args)
- self.run_error = "Couldn't remove files"
-
-
-class GitCommitAll(GitCommand):
- """Wrap git commit to commit all changes"""
- def __init__(self, verbose=False, **kwargs):
- args = ['-a'] + [ ['-q'], [] ][verbose]
- GitCommand.__init__(self, cmd='commit', args=args, **kwargs)
-
- def __call__(self, msg=''):
- args = [ [], ['-m', msg] ][len(msg) > 0]
- self.run_error = "Couldn't %s %s" % (self.cmd, " ".join(self.args + args))
- GitCommand.__call__(self, args)
-
-
def copy_from(orig_dir, filters=[]):
"""
copy a source tree over via tar
diff --git a/gbp/git.py b/gbp/git.py
index e43d58f7..3c2f1d1b 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -6,8 +6,7 @@
import re
import subprocess
import os.path
-from command_wrappers import (GitAdd, GitBranch, GitRm, GitCheckoutBranch,
- GitInit, GitCommand, copy_from)
+from command_wrappers import (GitCommand, GitInit, GitAdd, GitBranch, copy_from)
from errors import GbpError
import log
import dateutil.parser
@@ -196,7 +195,7 @@ class GitRepository(object):
"""switch to branch 'branch'"""
self.__check_path()
if self.get_branch() != branch:
- GitCheckoutBranch(branch)()
+ GitCommand("checkout", [ branch ])()
def create_branch(self, branch, rev=None):
"""create a new branch
@@ -355,20 +354,6 @@ class GitRepository(object):
raise GitRepositoryError, "can't write out current index"
return tree[0].strip()
- def replace_tree(self, src_dir, filters, verbose=False):
- """
- make the current wc match what's in src_dir
- @return: True if wc was modified
- @rtype: boolean
- """
- old = set(self.index_files())
- new = set(copy_from(src_dir, filters))
- GitAdd()(['-f', '.'])
- files = [ obj for obj in old - new if not os.path.isdir(obj)]
- if files:
- GitRm(verbose=verbose)(files)
- return not self.is_clean()[0]
-
def update_ref(self, ref, new, old=None, msg=None):
"""Update ref 'ref' to commit 'new'"""
args = [ ref, new ]