X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/b054c8bd5293f4b905460321a5c0e620b2232296..8c15e0e4c96f0ecdb40eaeeb05e9adec8021e973:/stgit/commands/export.py diff --git a/stgit/commands/export.py b/stgit/commands/export.py index 425d84a..db7b560 100644 --- a/stgit/commands/export.py +++ b/stgit/commands/export.py @@ -65,7 +65,7 @@ def func(parser, options, args): if len(boundaries) == 1: start = boundaries[0] stop = boundaries[0] - if len(boundaries) == 2: + elif len(boundaries) == 2: if boundaries[0] == '': start = applied[0] else: @@ -75,19 +75,19 @@ def func(parser, options, args): else: stop = boundaries[1] else: - raise MainException, 'incorrect parameters to "--range"' + raise CmdException, 'incorrect parameters to "--range"' if start in applied: start_idx = applied.index(start) else: - raise MainException, 'Patch "%s" not applied' % start + raise CmdException, 'Patch "%s" not applied' % start if stop in applied: stop_idx = applied.index(stop) + 1 else: - raise MainException, 'Patch "%s" not applied' % stop + raise CmdException, 'Patch "%s" not applied' % stop if start_idx >= stop_idx: - raise MainException, 'Incorrect patch range order' + raise CmdException, 'Incorrect patch range order' else: start_idx = 0 stop_idx = len(applied) @@ -137,19 +137,19 @@ def func(parser, options, args): try: descr = tmpl % tmpl_dict except KeyError, err: - raise MainException, 'Unknown patch template variable: %s' \ + raise CmdException, 'Unknown patch template variable: %s' \ % err except TypeError: - raise MainException, 'Only "%(name)s" variables are ' \ + raise CmdException, 'Only "%(name)s" variables are ' \ 'supported in the patch template' f = open(pfile, 'w+') f.write(descr) - f.close() # write the diff git.diff(rev1 = git_id('%s/bottom' % p), rev2 = git_id('%s/top' % p), - output = pfile, append = True) + out_fd = f) + f.close() patch_no += 1 series.close()