-options = [make_option('-a', '--all',
- help = 'push all the unapplied patches',
- action = 'store_true'),
- make_option('-n', '--number', type = 'int',
- help = 'push the specified number of patches'),
- make_option('--reverse',
- help = 'push the patches in reverse order',
- action = 'store_true'),
- make_option('-m', '--merged',
- help = 'check for patches merged upstream',
- action = 'store_true'),
- make_option('--undo',
- help = 'undo the last patch pushing',
- action = 'store_true')]
-
+args = [argparse.patch_range(argparse.unapplied_patches)]
+options = [
+ opt('-a', '--all', action = 'store_true',
+ short = 'Push all the unapplied patches'),
+ opt('-n', '--number', type = 'int',
+ short = 'Push the specified number of patches'),
+ opt('--reverse', action = 'store_true',
+ short = 'Push the patches in reverse order'),
+ opt('--set-tree', action = 'store_true',
+ short = 'Push the patch with the original tree', long = """
+ Push the patches, but don't perform a merge. Instead, the
+ resulting tree will be identical to the tree that the patch
+ previously created.
+
+ This can be useful when splitting a patch by first popping the
+ patch and creating a new patch with some of the
+ changes. Pushing the original patch with '--set-tree' will
+ avoid conflicts and only the remaining changes will be in the
+ patch.""")
+ ] + argparse.keep_option() + argparse.merged_option()
+
+directory = common.DirectoryHasRepositoryLib()