summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5dfb1af)
The command is now slightly changed in that the arguments for export
are patch ranges rather than a directory. The export directory is
specified with the --dir option. The patch also removes the --diff
option and adds a more general --extension option.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
push) _stg_patches $command _unapplied_patches ;;
# patch commands
delete) _stg_patches $command _all_patches ;;
push) _stg_patches $command _unapplied_patches ;;
# patch commands
delete) _stg_patches $command _all_patches ;;
- export) _stg_patches_options $command _applied_patches "-r --range" ;;
+ export) _stg_patches $command _applied_patches ;;
files) _stg_patches $command _all_patches ;;
log) _stg_patches $command _all_patches ;;
mail) _stg_patches $command _applied_patches ;;
files) _stg_patches $command _all_patches ;;
log) _stg_patches $command _all_patches ;;
mail) _stg_patches $command _applied_patches ;;
help = 'exports a series of patches to <dir> (or patches)'
help = 'exports a series of patches to <dir> (or patches)'
-usage = """%prog [options] [<dir>]
+usage = """%prog [options] [<patch1>] [<patch2>] [<patch3>..<patch4>]
-Export the applied patches into a given directory (defaults to
-'patches') in a standard unified GNU diff format. A template file
-(defaulting to '.git/patchexport.tmpl' or
+Export a range of applied patches to a given directory (defaults to
+'patches-<branch>') in a standard unified GNU diff format. A template
+file (defaulting to '.git/patchexport.tmpl' or
'~/.stgit/templates/patchexport.tmpl' or
'/usr/share/stgit/templates/patchexport.tmpl') can be used for the
patch format. The following variables are supported in the template
'~/.stgit/templates/patchexport.tmpl' or
'/usr/share/stgit/templates/patchexport.tmpl') can be used for the
patch format. The following variables are supported in the template
%(authdate)s - patch creation date
%(commname)s - committer's name
%(commemail)s - committer's e-mail
%(authdate)s - patch creation date
%(commname)s - committer's name
%(commemail)s - committer's e-mail
-'export' can also generate a diff for a range of patches."""
-
-options = [make_option('-n', '--numbered',
- help = 'prefix the patch names with order numbers',
- action = 'store_true'),
- make_option('-d', '--diff',
- help = 'append .diff to the patch names',
- action = 'store_true'),
+options = [make_option('-d', '--dir',
+ help = 'export patches to DIR instead of the default'),
make_option('-p', '--patch',
help = 'append .patch to the patch names',
action = 'store_true'),
make_option('-p', '--patch',
help = 'append .patch to the patch names',
action = 'store_true'),
+ make_option('-e', '--extension',
+ help = 'append .EXTENSION to the patch names'),
+ make_option('-n', '--numbered',
+ help = 'prefix the patch names with order numbers',
+ action = 'store_true'),
make_option('-t', '--template', metavar = 'FILE',
help = 'Use FILE as a template'),
make_option('-t', '--template', metavar = 'FILE',
help = 'Use FILE as a template'),
- make_option('-r', '--range',
- metavar = '[PATCH1][..[PATCH2]]',
- help = 'export patches between PATCH1 and PATCH2'),
make_option('-b', '--branch',
help = 'use BRANCH instead of the default one'),
make_option('-s', '--stdout',
make_option('-b', '--branch',
help = 'use BRANCH instead of the default one'),
make_option('-s', '--stdout',
def func(parser, options, args):
def func(parser, options, args):
- if len(args) == 0:
- dirname = 'patches-%s' % crt_series.get_branch()
- elif len(args) == 1:
- dirname = args[0]
+ """Export a range of patches.
+ """
+ if options.dir:
+ dirname = options.dir
- parser.error('incorrect number of arguments')
+ dirname = 'patches-%s' % crt_series.get_branch()
if not options.branch and git.local_changes():
print 'Warning: local changes in the tree. ' \
if not options.branch and git.local_changes():
print 'Warning: local changes in the tree. ' \
series = file(os.path.join(dirname, 'series'), 'w+')
applied = crt_series.get_applied()
series = file(os.path.join(dirname, 'series'), 'w+')
applied = crt_series.get_applied()
-
- if options.range:
- patches = parse_patches([options.range], applied)
+ if len(args) != 0:
+ patches = parse_patches(args, applied)
patch_no = 1;
for p in patches:
pname = p
patch_no = 1;
for p in patches:
pname = p
- if options.diff:
- pname = '%s.diff' % pname
- elif options.patch:
pname = '%s.patch' % pname
pname = '%s.patch' % pname
+ elif options.extension:
+ pname = '%s.%s' % (pname, options.extension)
if options.numbered:
pname = '%s-%s' % (str(patch_no).zfill(zpadding), pname)
pfile = os.path.join(dirname, pname)
if options.numbered:
pname = '%s-%s' % (str(patch_no).zfill(zpadding), pname)
pfile = os.path.join(dirname, pname)