diff options
author | Guido Guenther <agx@sigxcpu.org> | 2006-12-22 17:51:33 +0100 |
---|---|---|
committer | Guido Guenther <agx@bogon.sigxcpu.org> | 2006-12-22 17:51:33 +0100 |
commit | 62af3b51357f13584f1c8901c088280599c9ba81 (patch) | |
tree | 537825931df550f09c91e967aed8afbe33a52c3a /git_buildpackage/git_utils.py | |
parent | 8eadd9e525664b95ad58516cb3ad02ba6d544d73 (diff) |
git-import-orig: improve error message when the upstream branch cannot be found.debian/0.2.20
We cannot create the branch automatically since on repositories not created by
git-import-dsc it's not clear where to branch from. (Closes: #403990)
While doing that also remove pointless patch arguments from most of the git
helper functions
Minor doc updates
Diffstat (limited to 'git_buildpackage/git_utils.py')
-rw-r--r-- | git_buildpackage/git_utils.py | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/git_buildpackage/git_utils.py b/git_buildpackage/git_utils.py index 1cd5e6d5..3e68b2d8 100644 --- a/git_buildpackage/git_utils.py +++ b/git_buildpackage/git_utils.py @@ -8,14 +8,9 @@ import os.path import re -def is_repository_clean(path): - """Does the repository at path contain any uncommitted modifications""" +def is_repository_clean(): + """Does the repository contain any uncommitted modifications""" clean_msg='nothing to commit' - try: - curdir=os.path.abspath(os.path.curdir) - os.chdir(path) - except OSError: - return False popen = subprocess.Popen(['git','status'], stdout=subprocess.PIPE) popen.wait() out=popen.stdout.readlines() @@ -25,17 +20,11 @@ def is_repository_clean(path): ret=True else: ret=False - os.chdir(curdir) return (ret, "".join(out)) -def get_repository_branch(path): - """on what branch is the repository at path?""" - try: - curdir=os.path.abspath(os.path.curdir) - os.chdir(path) - except OSError: - return None +def get_repository_branch(): + """on what branch is the repository""" popen = subprocess.Popen(['git','branch'], stdout=subprocess.PIPE) popen.wait() for line in popen.stdout: @@ -43,6 +32,16 @@ def get_repository_branch(path): return line.split(' ',1)[1].strip() +def has_branch(branch): + """check if the repository has branch branch""" + popen = subprocess.Popen(['git','branch'], stdout=subprocess.PIPE) + popen.wait() + for line in popen.stdout: + if line.split(' ',1)[1].strip() == branch: + return True + return False + + def is_repository(path): """Is there a git repository at path""" if not path: |