summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2006-12-22 17:51:33 +0100
committerGuido Guenther <agx@bogon.sigxcpu.org>2006-12-22 17:51:33 +0100
commit62af3b51357f13584f1c8901c088280599c9ba81 (patch)
tree537825931df550f09c91e967aed8afbe33a52c3a
parent8eadd9e525664b95ad58516cb3ad02ba6d544d73 (diff)
downloadgit-buildpackage-62af3b51357f13584f1c8901c088280599c9ba81.tar.gz
git-buildpackage-62af3b51357f13584f1c8901c088280599c9ba81.tar.bz2
git-buildpackage-62af3b51357f13584f1c8901c088280599c9ba81.zip
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
-rw-r--r--debian/changelog7
-rw-r--r--docs/chapters/import.sgml9
-rw-r--r--docs/chapters/special.sgml6
-rwxr-xr-xgit-buildpackage4
-rwxr-xr-xgit-import-orig17
-rw-r--r--git_buildpackage/git_utils.py29
6 files changed, 44 insertions, 28 deletions
diff --git a/debian/changelog b/debian/changelog
index 19e961ea..b0556ae4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,13 @@
git-buildpackage (0.2.20) unstable; urgency=low
+ * git-import-orig: improve error message when the upstream branch cannot be
+ found. 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)
+ * remove pointless patch arguments from most of the git helper functions
* add some more documentation
- -- Guido Guenther <agx@sigxcpu.org> Fri, 22 Dec 2006 15:05:09 +0100
+ -- Guido Guenther <agx@sigxcpu.org> Fri, 22 Dec 2006 17:30:11 +0100
git-buildpackage (0.2.19) unstable; urgency=low
diff --git a/docs/chapters/import.sgml b/docs/chapters/import.sgml
index 7e54ed58..b91298a0 100644
--- a/docs/chapters/import.sgml
+++ b/docs/chapters/import.sgml
@@ -1,6 +1,6 @@
<chapter id="gbp.import">
<title>Importing Sources</title>
- <sect1 id="dbp.import.existing">
+ <sect1 id="gbp.import.existing">
<title>Importing already existing &debian; packages</title>
<para>Imporing an already exsting debian package into a git repository is as easy as:
<screen>
@@ -12,7 +12,7 @@
used.
</para>
</sect1>
- <sect1 id="dbp.import.new.upstream">
+ <sect1 id="gbp.import.new.upstream">
<title>Importing a new upstream version</title>
<para>Change into your git repository, make sure it has all local
modifications committed and do:
@@ -21,8 +21,11 @@
</screen>
</para>
</sect1>
- <sect1 id="dbp.import.convert">
+ <sect1 id="gbp.import.convert">
<title>Converting an existing &git; repository</title>
+ <para>
+ If the &git; repository wasn't created with &git-import-dsc; you have to tell
+ &git-buildpackage; and friends where to find the upstream sources.
<sect2>
<title>Upstream sources on a branch</title>
<para>
diff --git a/docs/chapters/special.sgml b/docs/chapters/special.sgml
index 03de2ec1..5fff3d39 100644
--- a/docs/chapters/special.sgml
+++ b/docs/chapters/special.sgml
@@ -1,6 +1,6 @@
<chapter id="gbp.special">
<title>Special usage cases</title>
- <sect1 id="dbp.special.dfsgfree">
+ <sect1 id="gbp.special.dfsgfree">
<title>Handling non-DFSG clean upstream sources</title>
<para>If you have to handle non DFSG clean upstream sources you can use a
different branch which you have to create once:
@@ -37,7 +37,7 @@ cleanup-script.sh
&gitcmd; pull . dfsg_clean
</screen>
- <sect1 id="dbp.special.nmus">
+ <sect1 id="gbp.special.nmus">
<title>Importing NMUs</title>
<para>
First create a branch that holds the NMUs once:
@@ -65,7 +65,7 @@ cleanup-script.sh
</note>
</sect1>
- <sect1 id="dbp.special.pbuilder">
+ <sect1 id="gbp.special.pbuilder">
<title>Using &pbuilder;</title>
<para>
Since pbuilder use different command line arguments than
diff --git a/git-buildpackage b/git-buildpackage
index 95d7216d..a0744a3e 100755
--- a/git-buildpackage
+++ b/git-buildpackage
@@ -85,13 +85,13 @@ def main(argv):
try:
if not options.ignore_new:
Command(options.clean_cmd)()
- (ret, out) = is_repository_clean('.')
+ (ret, out) = is_repository_clean()
if not ret:
print >>sys.stderr, "You have uncommitted changes in your source tree:"
print >>sys.stderr, out
print >>sys.stderr, "Use --git-ignore-new to ignore."
return 1
- branch=get_repository_branch('.')
+ branch=get_repository_branch()
if branch != options.debian_branch and not options.ignore_new:
print >>sys.stderr, "You are not on branch '%s' but on '%s'" % (options.debian_branch, branch)
print >>sys.stderr, "Use --git-ignore-new to ignore or --git-debian-branch to set the branch name."
diff --git a/git-import-orig b/git-import-orig
index 2edbd59b..1a187a7d 100755
--- a/git-import-orig
+++ b/git-import-orig
@@ -89,6 +89,14 @@ def main(argv):
print >>sys.stderr,"%s is not a git repository" % (os.path.abspath('.'),)
return 1
+ if not has_branch(options.upstream):
+ print >>sys.stderr, """
+Repository does not have branch '%s' for upstream sources. If there is none see
+/usr/share/doc/git-buildpackage/manual-html/gbp.import.convert.html on howto
+create it otherwise use --upstream-branch to specify it.
+""" % options.upstream
+ return 1
+
if options.version:
version = options.version
else:
@@ -100,7 +108,7 @@ def main(argv):
parser.print_help()
return 1
- (ret, out) = is_repository_clean('.')
+ (ret, out) = is_repository_clean()
if not ret:
print >>sys.stderr, "Repository has uncommitted changes, commit them first: "
print >>sys.stderr, out
@@ -109,12 +117,13 @@ def main(argv):
tmpdir = unpackOrig(tgz)
if not tmpdir:
return 1
- else:
- print "Unpacked orig to %s" % (tmpdir, )
+ else:
+ if options.verbose:
+ print "Unpacked orig to %s" % tmpdir
origdir=glob.glob(tmpdir+'/*')[0]
try:
- print "Importing %s to upstream branch..." % (tgz,)
+ print "Importing %s to upstream branch..." % tgz
gitCheckoutUpstream()
gitShowBranch()
GitLoadDirs()(origdir)
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: