aboutsummaryrefslogtreecommitdiffhomepage
path: root/git-import-dsc
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-01-14 15:40:33 +0100
committerGuido Günther <agx@sigxcpu.org>2010-01-14 15:40:33 +0100
commit34c1c43672f2b08864fe1fce04aae562772da5af (patch)
treea43144cb37b93c7565cff77e4983f65085b91b7d /git-import-dsc
parentab40623c04799a847ee41548e8f71088df79784f (diff)
Allow to skip imports of same version
Based on a patch by Christoph Göhre.
Diffstat (limited to 'git-import-dsc')
-rwxr-xr-xgit-import-dsc14
1 files changed, 12 insertions, 2 deletions
diff --git a/git-import-dsc b/git-import-dsc
index 37e6d518..f47dcb77 100755
--- a/git-import-dsc
+++ b/git-import-dsc
@@ -93,6 +93,8 @@ def print_dsc(dsc):
if dsc.epoch:
print "Epoch: %s" % dsc.epoch
+class SkipImport(Exception):
+ pass
def main(argv):
dirs = {'top': os.path.abspath(os.curdir)}
@@ -139,6 +141,9 @@ def main(argv):
dest="filters", action="append")
import_group.add_boolean_config_file_option(option_name="pristine-tar",
dest="pristine_tar")
+ import_group.add_option("--ignore-same-version", action="store_true",
+ dest="ignore_same_version", default=False,
+ help="don't import already imported version")
(options, args) = parser.parse_args(argv[1:])
if options.verbose:
@@ -183,6 +188,9 @@ def main(argv):
format = [(options.upstream_tag, "Upstream"), (options.debian_tag, "Debian")][src.native]
tag = build_tag(format[0], src.upstream_version)
msg = "%s version %s" % (format[1], src.upstream_version)
+ if repo.has_tag(tag) and options.ignore_same_version:
+ print "Tag %s already there" % tag
+ raise SkipImport
if not repo.has_tag(tag):
print "tag %s not found, importing %s tarball" % (tag, format[1])
@@ -215,13 +223,15 @@ def main(argv):
else:
print >>sys.stderr, "Warning: Didn't find a diff to apply."
except gbpc.CommandExecFailed:
- os.chdir(dirs['top'])
ret = 1
except GbpError, err:
if len(err.__str__()):
print >>sys.stderr, err
- os.chdir(dirs['top'])
ret = 1
+ except SkipImport:
+ pass
+ finally:
+ os.chdir(dirs['top'])
if dirs.has_key('tmp'):
gbpc.RemoveTree(dirs['tmp'])()