When no changelog file is available in the checkout, look for the
changelog in the repository. This allows for using git-import-orig when
the upstream branch is checked out, for example.

Thanks: Matthijs Kooijman
---
 git-import-orig |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/git-import-orig b/git-import-orig
index c6de631..de3e7bf 100755
--- a/git-import-orig
+++ b/git-import-orig
@@ -30,7 +30,8 @@ import tempfile
 import gbp.command_wrappers as gbpc
 from gbp.deb import (parse_changelog_file, unpack_orig, repack_orig,
                      NoChangelogError, has_epoch, tar_toplevel,
-                     guess_upstream_version, do_uscan)
+                     guess_upstream_version, do_uscan,
+                     parse_changelog_repo)
 from gbp.git import (FastImport, GitRepositoryError, GitRepository, build_tag)
 from gbp.config import GbpOptionParser, GbpOptionGroup
 from gbp.errors import (GbpError, GbpNothingImported)
@@ -334,7 +335,14 @@ on howto create it otherwise use --upstream-branch to 
specify it.
             cp = parse_changelog_file('debian/changelog')
             sourcepackage = cp['Source']
         except NoChangelogError:
-            sourcepackage = ask_package_name(guessed_package)
+            try:
+                # Check the changelog file from the repository, in case
+                # we're not on the debian-branch (but upstream, for
+                # example).
+                cp = parse_changelog_repo(repo, options.debian_branch, 
'debian/changelog')
+                sourcepackage = cp['Source']
+            except NoChangelogError:
+                sourcepackage = ask_package_name(guessed_package)
 
         # Try to find the version.
         if options.version:
@@ -418,6 +426,9 @@ on howto create it otherwise use --upstream-branch to 
specify it.
                 if options.postimport:
                     epoch = ''
                     if os.access('debian/changelog', os.R_OK):
+                        # No need to check the changelog file from the
+                        # repository, since we're certain that we're on
+                        # the debian-branch
                         cp = parse_changelog_file('debian/changelog')
                         if has_epoch(cp):
                             epoch = '%s:' % cp['Epoch']
-- 
1.7.1




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to