kha/{safe,experimental} updated
Just pushed out the stack log stuff to kha/safe. It really should be ready for wider use at this point, and it was getting tiresome to keep rebasing it.
One patch is still in experimental -- it depends on a new git feature that isn't in any release yet.
There's also a patch for much improved bash completion support; I'll post it as a reply to this mail.
-+-
The following changes since commit 3ce5fec2ef4154369653a41eb7692aca25878298:
Catalin Marinas (1):
Merge branch 'stable'
are available in the git repository at:
git://repo.or.cz/stgit/kha.git safe
Daniel White (1):
Fixes for auto-generation of man pages
David Kågedal (1):
Add support for initializing a branch for stgit from Emacs.
Karl Hasselström (24):
Auto-generate man pages for all StGit commands asciidoc.conf: Steal updates from git Generate command lists automatically
Write to a stack log when stack is modified New command: stg reset
Log conflicts separately
Log conflicts separately for all commands
Add a --hard flag to stg reset
Don't write a log entry if there were no changes Move stack reset function to a shared location New command: stg undo
New command: stg redo
Log and undo external modifications
Test that stg coalesce handles head != top gracefully Check for top == head at the start of every transaction Make "stg log" show stack log instead of patch log Convert "stg refresh" to the new infrastructure New refresh tests
Remove --undo flags from stg commands and docs Refactor stgit.commands.edit
Invoke the correct interactive editor Implement "stg refresh --edit" again Automatic bash completion
Read several objects at once with git cat-file --batch
.gitignore | 1 + Documentation/.gitignore | 5 +- Documentation/COMMAND-TEMPLATE.txt | 42 --- Documentation/Makefile | 15 +- Documentation/asciidoc.conf | 100 +++++-- Documentation/stg-branch.txt | 114 -------- Documentation/stg-clone.txt | 32 --- Documentation/stg-init.txt | 29 -- Documentation/stg-new.txt | 115 -------- Documentation/stg-sink.txt | 49 ---- Documentation/stg.txt | 138 +---------- Documentation/tutorial.txt | 4 +- INSTALL | 4 +- Makefile | 21 ++- TODO | 2 - contrib/stgit-completion.bash | 270 ------------------- contrib/stgit.el | 12 +- setup.py | 4 +- stg-build | 41 +++ stgit/argparse.py | 260 +++++++++++++++--- stgit/commands/.gitignore | 1 + stgit/commands/__init__.py | 78 ++++++ stgit/commands/branch.py | 148 +++++++---- stgit/commands/clean.py | 23 +- stgit/commands/clone.py | 23 +- stgit/commands/coalesce.py | 16 +- stgit/commands/commit.py | 27 ++- stgit/commands/common.py | 18 +- stgit/commands/delete.py | 19 +- stgit/commands/diff.py | 36 ++-- stgit/commands/edit.py | 106 ++------ stgit/commands/export.py | 53 ++-- stgit/commands/files.py | 31 ++- stgit/commands/float.py | 24 +- stgit/commands/fold.py | 26 +- stgit/commands/goto.py | 16 +- stgit/commands/hide.py | 23 +- stgit/commands/id.py | 15 +- stgit/commands/imprt.py | 98 ++++---- stgit/commands/init.py | 17 +- stgit/commands/log.py | 192 +++++--------- stgit/commands/mail.py | 126 ++++----- stgit/commands/new.py | 39 ++-- stgit/commands/patches.py | 27 +- stgit/commands/pick.py | 57 ++-- stgit/commands/pop.py | 33 ++-- stgit/commands/pull.py | 28 +- stgit/commands/push.py | 65 ++--- stgit/commands/rebase.py | 30 +- stgit/commands/redo.py | 56 ++++ stgit/commands/refresh.py | 355 ++++++++++++++++-------- stgit/commands/rename.py | 32 ++- stgit/commands/repair.py | 21 +- stgit/commands/reset.py | 65 +++++ stgit/commands/resolved.py | 33 ++-- stgit/commands/series.py | 82 +++--- stgit/commands/show.py | 36 ++-- stgit/commands/sink.py | 46 +++- stgit/commands/status.py | 61 ++--- stgit/commands/sync.py | 56 ++--- stgit/commands/top.py | 18 +- stgit/commands/uncommit.py | 34 ++- stgit/commands/undo.py | 53 ++++ stgit/commands/unhide.py | 24 +- stgit/completion.py | 140 ++++++++++ stgit/git.py | 4 - stgit/lib/edit.py | 99 +++++++ stgit/lib/git.py | 116 ++++++++- stgit/lib/log.py | 524 ++++++++++++++++++++++++++++++++++++ stgit/lib/stack.py | 25 ++ stgit/lib/transaction.py | 128 ++++++--- stgit/main.py | 140 +--------- stgit/run.py | 19 ++ stgit/stack.py | 45 +--- stgit/utils.py | 22 +- t/t1200-push-modified.sh | 2 +- t/t1201-pull-trailing.sh | 2 +- t/t1202-push-undo.sh | 8 +- t/t1400-patch-history.sh | 103 ------- t/t2300-refresh-subdir.sh | 29 ++- t/t2600-coalesce.sh | 13 + t/t2701-refresh-p.sh | 2 +- t/t3100-reset.sh | 160 +++++++++++ t/t3101-reset-hard.sh | 53 ++++ t/t3102-undo.sh | 81 ++++++ t/t3103-undo-hard.sh | 53 ++++ t/t3104-redo.sh | 114 ++++++++ t/t3105-undo-external-mod.sh | 65 +++++ t/t3300-edit.sh | 12 +- t/test-lib.sh | 5 +- 90 files changed, 3348 insertions(+), 2241 deletions(-) delete mode 100644 Documentation/COMMAND-TEMPLATE.txt delete mode 100644 Documentation/stg-branch.txt delete mode 100644 Documentation/stg-clone.txt delete mode 100644 Documentation/stg-init.txt delete mode 100644 Documentation/stg-new.txt delete mode 100644 Documentation/stg-sink.txt delete mode 100644 contrib/stgit-completion.bash create mode 100755 stg-build create mode 100644 stgit/commands/.gitignore create mode 100644 stgit/commands/redo.py create mode 100644 stgit/commands/reset.py create mode 100644 stgit/commands/undo.py create mode 100644 stgit/completion.py create mode 100644 stgit/lib/edit.py create mode 100644 stgit/lib/log.py delete mode 100755 t/t1400-patch-history.sh create mode 100755 t/t3100-reset.sh create mode 100755 t/t3101-reset-hard.sh create mode 100755 t/t3102-undo.sh create mode 100755 t/t3103-undo-hard.sh create mode 100755 t/t3104-redo.sh create mode 100755 t/t3105-undo-external-mod.sh
-+-
The following changes since commit 2f34dbb4625e0c04a983229477a50ba4de7036bf:
Karl Hasselström (1):
Read several objects at once with git cat-file --batch
are available in the git repository at:
git://repo.or.cz/stgit/kha.git experimental
Karl Hasselström (1):
Diff several trees at once with git diff-tree --stdin
INSTALL | 5 +++-- stgit/lib/git.py | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 6 deletions(-)
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle
PATCH 1/1 Automatic bash completion
Teach the build process to create a bash tab completion script. This has three benefits:
1. The tab completion gets faster, since it no longer has to run stg to figure out the set of available flags for each command.
2. The tab completion script used to encode the list of stg subcommands, and the kind of arguments each subcommand expected. This information now lives in just one place: the subcommand's module.
3. The tab completion script now knows what kind of argument each flag wants, and can tab complete those as well. So "stg refresh <tab>" will complete dirty files, but "stg refresh -p <tab>" will complete patch names.
---
.gitignore | 1 Makefile | 5 + contrib/stgit-completion.bash | 270 ----------------------------------------- setup.py | 4 - stg-build | 6 + stgit/argparse.py | 92 ++++++++++++-- stgit/commands/branch.py | 3 stgit/commands/clean.py | 1 stgit/commands/clone.py | 3 stgit/commands/coalesce.py | 2 stgit/commands/commit.py | 3 stgit/commands/delete.py | 5 + stgit/commands/diff.py | 4 + stgit/commands/edit.py | 2 stgit/commands/export.py | 9 + stgit/commands/files.py | 2 stgit/commands/float.py | 4 - stgit/commands/fold.py | 5 - stgit/commands/goto.py | 2 stgit/commands/hide.py | 6 + stgit/commands/id.py | 3 stgit/commands/imprt.py | 3 stgit/commands/init.py | 1 stgit/commands/log.py | 7 + stgit/commands/mail.py | 5 + stgit/commands/new.py | 1 stgit/commands/patches.py | 5 - stgit/commands/pick.py | 9 + stgit/commands/pop.py | 3 stgit/commands/pull.py | 3 stgit/commands/push.py | 3 stgit/commands/rebase.py | 3 stgit/commands/redo.py | 1 stgit/commands/refresh.py | 4 - stgit/commands/rename.py | 6 + stgit/commands/repair.py | 1 stgit/commands/reset.py | 4 + stgit/commands/resolved.py | 4 - stgit/commands/series.py | 8 + stgit/commands/show.py | 5 + stgit/commands/sink.py | 6 + stgit/commands/status.py | 3 stgit/commands/sync.py | 8 + stgit/commands/top.py | 4 - stgit/commands/uncommit.py | 6 + stgit/commands/undo.py | 1 stgit/commands/unhide.py | 5 - stgit/completion.py | 140 +++++++++++++++++++++ 48 files changed, 354 insertions(+), 327 deletions(-) delete mode 100644 contrib/stgit-completion.bash create mode 100644 stgit/completion.py
.gitignore +1 -0
@@ -6,3 +6,4 @@ patches-* release.sh setup.cfg.rpm snapshot.sh +stgit-completion.bash
Makefile +4 -1
@@ -7,13 +7,16 @@ TEST_PATCHES ?= .. all: build $(PYTHON) setup.py build -build: stgit/commands/cmdlist.py +build: stgit/commands/cmdlist.py stgit-completion.bash ALL_PY = $(shell find stgit -name '*.py') stgit/commands/cmdlist.py: $(ALL_PY) $(PYTHON) stg-build --py-cmd-list > $@ +stgit-completion.bash: $(ALL_PY) + $(PYTHON) stg-build --bash-completion > $@ + install: build $(PYTHON) setup.py install --prefix=$(prefix) --root=$(DESTDIR) --force
contrib/stgit-completion.bash deleted +0 -270
270 lines not on this page · raw message
setup.py +2 -2
@@ -59,8 +59,8 @@ def __run_setup(): ('share/stgit/examples', glob.glob('examples/*.tmpl')), ('share/stgit/examples', ['examples/gitconfig']), ('share/stgit/contrib', ['contrib/diffcol.sh', - 'contrib/stgbashprompt.sh', - 'contrib/stgit-completion.bash']), + 'contrib/stgbashprompt.sh']), + ('share/stgit/completion', ['stgit-completion.bash']) ]) # Check the minimum versions required
stg-build +5 -1
@@ -2,7 +2,7 @@ # -*- python -*- import optparse, sys import stgit.main -from stgit import argparse, commands +from stgit import argparse, commands, completion def main(): op = optparse.OptionParser()
@@ -14,6 +14,8 @@ def main(): help = 'Print asciidoc command list') op.add_option('--py-cmd-list', action = 'store_true', help = 'Write Python command list') + op.add_option('--bash-completion', action = 'store_true', + help = 'Write bash completion code') options, args = op.parse_args() if args: op.error('Wrong number of arguments')
@@ -30,6 +32,8 @@ def main(): elif options.py_cmd_list: commands.py_commands(commands.get_commands(allow_cached = False), sys.stdout) + elif options.bash_completion: + completion.write_completion(sys.stdout) else: op.error('No command')
stgit/argparse.py +81 -11
142 lines not on this page · raw message
stgit/commands/branch.py +2 -1
@@ -20,7 +20,7 @@ from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git, basedir +from stgit import argparse, stack, git, basedir from stgit.lib import log help = 'Branch operations: switch, list, create, rename, delete, ...'
@@ -45,6 +45,7 @@ within a git repository. 'stg branch' <branch>:: Switch to the given branch.""" +args = [argparse.all_branches] options = [ opt('-l', '--list', action = 'store_true', short = 'List the branches contained in this repository', long = """
stgit/commands/clean.py +1 -0
@@ -28,6 +28,7 @@ Delete the empty patches in the whole series or only those applied or unapplied. A patch is considered empty if the two commit objects representing its boundaries refer to the same tree object.""" +args = [] options = [ opt('-a', '--applied', action = 'store_true', short = 'Delete the empty applied patches'),
stgit/commands/clone.py +2 -1
@@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import sys, os from stgit.commands.common import * from stgit.utils import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Make a local clone of a remote repository' kind = 'repo'
@@ -35,6 +35,7 @@ commands of stglink:branch[]. The target directory <dir> will be created by this command, and must not already exist.""" +args = [argparse.repo, argparse.dir] options = [] directory = DirectoryAnywhere(needs_current_series = False, log = False)
stgit/commands/coalesce.py +2 -0
@@ -34,6 +34,8 @@ If there are conflicts when reordering the patches to match the order you specify, you will have to resolve them manually just as if you had done a sequence of pushes and pops yourself.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches)] options = [opt('-n', '--name', short = 'Name of coalesced patch') ] + argparse.message_options(save_template = True)
stgit/commands/commit.py +3 -0
@@ -19,6 +19,7 @@ from stgit.argparse import opt from stgit.commands import common from stgit.lib import transaction from stgit.out import * +from stgit import argparse help = 'Permanently store the applied patches into the stack base' kind = 'stack'
@@ -40,6 +41,8 @@ The -n/--number option specifies the number of applied patches to commit (counting from the bottom of the stack). If -a/--all is given, all applied patches are committed.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches)] options = [ opt('-n', '--number', type = 'int', short = 'Commit the specified number of patches'),
stgit/commands/delete.py +4 -1
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from stgit.argparse import opt from stgit.commands import common from stgit.lib import transaction +from stgit import argparse help = 'Delete patches' kind = 'patch'
@@ -28,8 +29,10 @@ Delete the patches passed as arguments. Note that the 'delete' operation is irreversible.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches)] options = [ - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default branch')] directory = common.DirectoryHasRepositoryLib()
stgit/commands/diff.py +4 -0
@@ -38,8 +38,12 @@ representing the bottom of the current stack. rev = '[branch:](<patch>|{base}) | <tree-ish>'""" +args = [argparse.known_files, argparse.dirty_files] options = [ opt('-r', '--range', metavar = 'rev1[..[rev2]]', dest = 'revs', + args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches, + argparse.hidden_patches)], short = 'Show the diff between revisions'), opt('-s', '--stat', action = 'store_true', short = 'Show the stat instead of the diff'),
stgit/commands/edit.py +2 -0
@@ -54,6 +54,8 @@ If the patch diff is edited but does not apply, no changes are made to the patch at all. The edited patch is saved to a file which you can feed to "stg edit --file", once you have made sure it does apply.""" +args = [argparse.applied_patches, argparse.unapplied_patches, + argparse.hidden_patches] options = [ opt('-d', '--diff', action = 'store_true', short = 'Edit the patch diff'),
stgit/commands/export.py +6 -3
@@ -47,8 +47,11 @@ file: %(commname)s - committer's name %(commemail)s - committer's e-mail""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches, + argparse.hidden_patches)] options = [ - opt('-d', '--dir', + opt('-d', '--dir', args = [argparse.dir], short = 'Export patches to DIR instead of the default'), opt('-p', '--patch', action = 'store_true', short = 'Append .patch to the patch names'),
@@ -56,9 +59,9 @@ options = [ short = 'Append .EXTENSION to the patch names'), opt('-n', '--numbered', action = 'store_true', short = 'Prefix the patch names with order numbers'), - opt('-t', '--template', metavar = 'FILE', + opt('-t', '--template', metavar = 'FILE', args = [argparse.files], short = 'Use FILE as a template'), - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default branch'), opt('-s', '--stdout', action = 'store_true', short = 'Dump the patches to the standard output'),
stgit/commands/files.py +2 -0
@@ -34,6 +34,8 @@ given patch. Note that this command doesn't show the files modified in the working tree and not yet included in the patch by a 'refresh' command. Use the 'diff' or 'status' commands for these files.""" +args = [argparse.applied_patches, argparse.unapplied_patches, + argparse.hidden_patches] options = [ opt('-s', '--stat', action = 'store_true', short = 'Show the diffstat'),
stgit/commands/float.py +3 -1
@@ -20,7 +20,7 @@ import sys, os from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Push patches to the top, even if applied' kind = 'stack'
@@ -32,6 +32,8 @@ necessary pop and push operations will be performed to accomplish this. The '--series' option can be used to rearrange the (top) patches as specified by the given series file (or the standard input).""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches)] options = [ opt('-s', '--series', action = 'store_true', short = 'Rearrange according to a series file')]
stgit/commands/fold.py +3 -2
@@ -20,7 +20,7 @@ from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Integrate a GNU diff patch into the current patch' kind = 'patch'
@@ -33,10 +33,11 @@ performed with the current top. With the --base option, the patch is applied onto the specified base and a three-way merged is performed with the current top.""" +args = [argparse.files] options = [ opt('-t', '--threeway', action = 'store_true', short = 'Perform a three-way merge with the current patch'), - opt('-b', '--base', + opt('-b', '--base', args = [argparse.commit], short = 'Use BASE instead of HEAD applying the patch')] directory = DirectoryHasRepository(log = True)
stgit/commands/goto.py +2 -0
@@ -17,6 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from stgit.commands import common from stgit.lib import transaction +from stgit import argparse help = 'Push or pop patches to the given one' kind = 'stack'
@@ -25,6 +26,7 @@ description = """ Push/pop patches to/from the stack until the one given on the command line becomes current.""" +args = [argparse.other_applied_patches, argparse.unapplied_patches] options = [] directory = common.DirectoryHasRepositoryLib()
stgit/commands/hide.py +4 -2
@@ -20,7 +20,7 @@ from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Hide a patch in the series' kind = 'stack'
@@ -29,8 +29,10 @@ description = """ Hide a range of unapplied patches so that they are no longer shown in the plain 'series' command output.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches)] options = [ - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default branch')] directory = DirectoryHasRepository(log = True)
stgit/commands/id.py +3 -0
@@ -18,6 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from stgit.out import out from stgit.commands import common from stgit.lib import stack +from stgit import argparse help = 'Print the git hash value of a StGit reference' kind = 'repo'
@@ -30,6 +31,8 @@ or the base of the stack. If no branch is specified, it defaults to the current one. The bottom of a patch is accessible with the '[<branch>:]<patch>^' format.""" +args = [argparse.applied_patches, argparse.unapplied_patches, + argparse.hidden_patches] options = [] directory = common.DirectoryHasRepositoryLib()
stgit/commands/imprt.py +2 -1
@@ -44,6 +44,7 @@ stack. The patch description has to be separated from the data with a '---' line.""" +args = [argparse.files] options = [ opt('-m', '--mail', action = 'store_true', short = 'Import the patch from a standard e-mail file'),
@@ -61,7 +62,7 @@ options = [ short = 'Ignore the applied patches in the series'), opt('--replace', action = 'store_true', short = 'Replace the unapplied patches in the series'), - opt('-b', '--base', + opt('-b', '--base', args = [argparse.commit], short = 'Use BASE instead of HEAD for file importing'), opt('-e', '--edit', action = 'store_true', short = 'Invoke an editor for the patch description'),
stgit/commands/init.py +1 -0
@@ -27,6 +27,7 @@ Initialise the current git branch to be used as an StGIT stack. The branch (and the git repository it is in) must already exist and contain at least one commit.""" +args = [] options = [] directory = common.DirectoryHasRepositoryLib()
stgit/commands/log.py +5 -2
@@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import os.path from optparse import make_option -from stgit import run +from stgit import argparse, run from stgit.argparse import opt from stgit.commands import common from stgit.lib import log
@@ -37,8 +37,11 @@ the named patches. "stg undo" and "stg redo" let you step back and forth in the patch stack. "stg reset" lets you go directly to any state.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches, + argparse.hidden_patches)] options = [ - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default one'), opt('-p', '--patch', action = 'store_true', short = 'Show the refresh diffs'),
stgit/commands/mail.py +4 -1
@@ -93,6 +93,9 @@ the following: %(prefix)s - 'prefix ' string passed on the command line %(shortdescr)s - the first line of the patch description""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches, + argparse.hidden_patches)] options = [ opt('-a', '--all', action = 'store_true', short = 'E-mail all the applied patches'),
@@ -134,7 +137,7 @@ options = [ short = 'Password for SMTP authentication'), opt('-T', '--smtp-tls', action = 'store_true', short = 'Use SMTP with TLS encryption'), - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default branch'), opt('-m', '--mbox', action = 'store_true', short = 'Generate an mbox file instead of sending')
stgit/commands/new.py +1 -0
@@ -39,6 +39,7 @@ the patch, unless the '--message' flag already specified one. The 'patchdescr.tmpl' template file (if available) is used to pre-fill the editor.""" +args = [] options = (argparse.author_committer_options() + argparse.message_options(save_template = True) + argparse.sign_options())
stgit/commands/patches.py +3 -2
@@ -21,7 +21,7 @@ from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Show the applied patches modifying a file' kind = 'stack'
@@ -32,10 +32,11 @@ it shows the patches affected by the local tree modifications. The '--diff' option also lists the patch log and the diff for the given files.""" +args = [argparse.known_files] options = [ opt('-d', '--diff', action = 'store_true', short = 'Show the diff for the given files'), - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default branch')] directory = DirectoryHasRepository(log = False)
stgit/commands/pick.py +6 -3
@@ -20,7 +20,7 @@ from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git +from stgit import argparse, stack, git from stgit.stack import Series help = 'Import a patch from a different branch or a commit object'
@@ -34,14 +34,17 @@ used as the name of the current patch. It can be overridden with the option. The log and author information are those of the commit object.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches, + argparse.hidden_patches)] options = [ opt('-n', '--name', short = 'Use NAME as the patch name'), - opt('-B', '--ref-branch', + opt('-B', '--ref-branch', args = [argparse.stg_branches], short = 'Pick patches from BRANCH'), opt('-r', '--reverse', action = 'store_true', short = 'Reverse the commit object before importing'), - opt('-p', '--parent', metavar = 'COMMITID', + opt('-p', '--parent', metavar = 'COMMITID', args = [argparse.commit], short = 'Use COMMITID as parent'), opt('-x', '--expose', action = 'store_true', short = 'Append the imported commit id to the patch log'),
stgit/commands/pop.py +2 -1
@@ -20,7 +20,7 @@ import sys, os from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Pop one or more patches from the stack' kind = 'stack'
@@ -35,6 +35,7 @@ patches passed on the command line are popped from the stack. Some of the push operations may fail because of conflicts ("stg undo" would revert the last push operation).""" +args = [argparse.patch_range(argparse.applied_patches)] options = [ opt('-a', '--all', action = 'store_true', short = 'Pop all the applied patches'),
stgit/commands/pull.py +2 -1
@@ -21,7 +21,7 @@ from stgit.commands.common import * from stgit.utils import * from stgit.out import * from stgit.config import GitConfigException -from stgit import stack, git +from stgit import argparse, stack, git help = 'Pull changes from a remote repository' kind = 'stack'
@@ -37,6 +37,7 @@ resolved and the patch pushed again. Check the 'git fetch' documentation for the <repository> format.""" +args = [argparse.repo] options = [ opt('-n', '--nopush', action = 'store_true', short = 'Do not push the patches back after pulling'),
stgit/commands/push.py +2 -1
@@ -21,7 +21,7 @@ from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Push one or more patches onto the stack' kind = 'stack'
@@ -38,6 +38,7 @@ conflicting push with 'stg undo'). The command also notifies when the patch becomes empty (fully merged upstream) or is modified (three-way merged) by the 'push' operation.""" +args = [argparse.patch_range(argparse.unapplied_patches)] options = [ opt('-a', '--all', action = 'store_true', short = 'Push all the unapplied patches'),
stgit/commands/rebase.py +2 -1
@@ -19,7 +19,7 @@ import sys, os from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Move the stack base to another point in history' kind = 'stack'
@@ -40,6 +40,7 @@ Or if you want to skip that patch: $ stg undo --hard $ stg push next-patch..top-patch""" +args = [argparse.commit] options = [ opt('-n', '--nopush', action = 'store_true', short = 'Do not push the patches back after rebasing'),
stgit/commands/redo.py +1 -0
@@ -32,6 +32,7 @@ the effects of consecutive invocations of "stg undo". It is an error to run "stg redo" if the last command was not an undo.""" +args = [] options = [ opt('-n', '--number', type = 'int', metavar = 'N', default = 1, short = 'Undo the last N undos'),
stgit/commands/refresh.py +3 -1
@@ -48,6 +48,7 @@ the patch stack log; this means that one undo step will undo the merge between the other patch and the temp patch, and two undo steps will additionally get rid of the temp patch.""" +args = [argparse.dirty_files] options = [ opt('-u', '--update', action = 'store_true', short = 'Only update the current patch files'),
@@ -55,7 +56,8 @@ options = [ short = 'Refresh from index instead of worktree', long = """ Instead of setting the patch top to the current contents of the worktree, set it to the current contents of the index."""), - opt('-p', '--patch', + opt('-p', '--patch', args = [argparse.other_applied_patches, + argparse.unapplied_patches], short = 'Refresh (applied) PATCH instead of the top patch'), opt('-e', '--edit', action = 'store_true', short = 'Invoke an editor for the patch description'),
stgit/commands/rename.py +4 -2
@@ -20,7 +20,7 @@ from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Rename a patch' kind = 'patch'
@@ -29,8 +29,10 @@ description = """ Rename <oldpatch> into <newpatch> in a series. If <oldpatch> is not given, the top-most patch will be renamed.""" +args = [argparse.applied_patches, argparse.unapplied_patches, + argparse.hidden_patches] options = [ - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'use BRANCH instead of the default one')] directory = DirectoryHasRepository(log = True)
stgit/commands/repair.py +1 -0
@@ -69,6 +69,7 @@ NOTE: If using git commands on the stack was a mistake, running "stg repair" is _not_ what you want. In that case, what you want is option (1) above.""" +args = [] options = [] directory = DirectoryGotoToplevel(log = True)
stgit/commands/reset.py +4 -0
@@ -21,6 +21,7 @@ from stgit.argparse import opt from stgit.commands import common from stgit.lib import git, log, transaction from stgit.out import out +from stgit import argparse help = 'Reset the patch stack to an earlier state' kind = 'stack'
@@ -33,6 +34,9 @@ a commit id from a stack log; "stg log" lets you view this log, and If one or more patch names are given, reset only those patches, and leave the rest alone.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches, + argparse.hidden_patches)] options = [ opt('--hard', action = 'store_true', short = 'Discard changes in your index/worktree')]
stgit/commands/resolved.py +3 -1
@@ -20,7 +20,7 @@ import sys, os from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * -from stgit import stack, git, basedir +from stgit import argparse, stack, git, basedir from stgit.config import config, file_extensions from stgit.gitmergeonefile import interactive_merge
@@ -32,10 +32,12 @@ Mark a merge conflict as resolved. The conflicts can be seen with the 'status' command, the corresponding files being prefixed with a 'C'.""" +args = [argparse.conflicting_files] options = [ opt('-a', '--all', action = 'store_true', short = 'Mark all conflicts as solved'), opt('-r', '--reset', metavar = '(ancestor|current|patched)', + args = [argparse.strings('ancestor', 'current', 'patched')], short = 'Reset the file(s) to the given state'), opt('-i', '--interactive', action = 'store_true', short = 'Run the interactive merging tool')]
stgit/commands/series.py +6 -2
@@ -21,6 +21,7 @@ from stgit.commands import common from stgit.commands.common import parse_patches from stgit.out import out from stgit.config import config +from stgit import argparse help = 'Print the patch series' kind = 'stack'
@@ -31,8 +32,11 @@ range. The applied patches are prefixed with a '+', the unapplied ones with a '-' and the hidden ones with a '!'. The current patch is prefixed with a '>'. Empty patches are prefixed with a '0'.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches, + argparse.hidden_patches)] options = [ - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default branch'), opt('-a', '--all', action = 'store_true', short = 'Show all patches, including the hidden ones'),
@@ -42,7 +46,7 @@ options = [ short = 'Show the unapplied patches only'), opt('-H', '--hidden', action = 'store_true', short = 'Show the hidden patches only'), - opt('-m', '--missing', metavar = 'BRANCH', + opt('-m', '--missing', metavar = 'BRANCH', args = [argparse.stg_branches], short = 'Show patches in BRANCH missing in current'), opt('-c', '--count', action = 'store_true', short = 'Print the number of patches in the series'),
stgit/commands/show.py +4 -1
@@ -28,8 +28,11 @@ description = """ Show the commit log and the diff corresponding to the given patches. The output is similar to that generated by 'git show'.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches, + argparse.hidden_patches)] options = [ - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default branch'), opt('-a', '--applied', action = 'store_true', short = 'Show the applied patches'),
stgit/commands/sink.py +4 -2
@@ -20,7 +20,7 @@ import sys, os from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Send patches deeper down the stack' kind = 'stack'
@@ -41,12 +41,14 @@ including <target patch>), then pushing the patches to sink, and then (unless '--nopush' is also given) pushing back into place the formerly-applied patches.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches)] options = [ opt('-n', '--nopush', action = 'store_true', short = 'Do not push the patches back after sinking', long = """ Do not push back on the stack the formerly-applied patches. Only the patches to sink are pushed."""), - opt('-t', '--to', metavar = 'TARGET', + opt('-t', '--to', metavar = 'TARGET', args = [argparse.applied_patches], short = 'Sink patches below the TARGET patch', long = """ Specify a target patch to place the patches below, instead of sinking them to the bottom of the stack.""")]
stgit/commands/status.py +2 -1
@@ -20,7 +20,7 @@ import sys, os from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Show the tree status' kind = 'wc'
@@ -39,6 +39,7 @@ under revision control. The files are prefixed as follows: An 'stg refresh' command clears the status of the modified, new and deleted files.""" +args = [argparse.files] options = [ opt('-m', '--modified', action = 'store_true', short = 'Show modified files only'),
stgit/commands/sync.py +5 -3
@@ -21,7 +21,7 @@ from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Synchronise patches with a branch or a series' kind = 'patch'
@@ -33,12 +33,14 @@ for keeping patches on several branches in sync. Note that the operation may fail for some patches because of conflicts. The patches in the series must apply cleanly.""" +args = [argparse.patch_range(argparse.applied_patches, + argparse.unapplied_patches)] options = [ opt('-a', '--all', action = 'store_true', short = 'Synchronise all the applied patches'), - opt('-B', '--ref-branch', + opt('-B', '--ref-branch', args = [argparse.stg_branches], short = 'Syncronise patches with BRANCH'), - opt('-s', '--series', + opt('-s', '--series', args = [argparse.files], short = 'Syncronise patches with SERIES')] directory = DirectoryGotoToplevel(log = True)
stgit/commands/top.py +3 -1
@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from stgit.argparse import opt from stgit.commands import common from stgit.out import out +from stgit import argparse help = 'Print the name of the top patch' kind = 'stack'
@@ -26,8 +27,9 @@ usage = [''] description = """ Print the name of the current (topmost) patch.""" +args = [] options = [ - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default branch')] directory = common.DirectoryHasRepositoryLib()
stgit/commands/uncommit.py +4 -2
@@ -21,7 +21,7 @@ from stgit.argparse import opt from stgit.commands import common from stgit.lib import transaction from stgit.out import * -from stgit import utils +from stgit import argparse, utils help = 'Turn regular git commits into StGit patches' kind = 'stack'
@@ -49,10 +49,12 @@ given commit should be uncommitted. Only commits with exactly one parent can be uncommitted; in other words, you can't uncommit a merge.""" +args = [] options = [ opt('-n', '--number', type = 'int', short = 'Uncommit the specified number of commits'), - opt('-t', '--to', short = 'Uncommit to the specified commit'), + opt('-t', '--to', args = [argparse.commit], + short = 'Uncommit to the specified commit'), opt('-x', '--exclusive', action = 'store_true', short = 'Exclude the commit specified by the --to option')]
stgit/commands/undo.py +1 -0
@@ -29,6 +29,7 @@ description = """ Reset the patch stack to the previous state. Consecutive invocations of "stg undo" will take you ever further into the past.""" +args = [] options = [ opt('-n', '--number', type = 'int', metavar = 'N', default = 1, short = 'Undo the last N commands'),
stgit/commands/unhide.py +3 -2
@@ -20,7 +20,7 @@ from stgit.argparse import opt from stgit.commands.common import * from stgit.utils import * from stgit.out import * -from stgit import stack, git +from stgit import argparse, stack, git help = 'Unhide a hidden patch' kind = 'stack'
@@ -29,8 +29,9 @@ description = """ Unhide a hidden range of patches so that they are shown in the plain 'stg series' command output.""" +args = [argparse.patch_range(argparse.hidden_patches)] options = [ - opt('-b', '--branch', + opt('-b', '--branch', args = [argparse.stg_branches], short = 'Use BRANCH instead of the default branch')] directory = DirectoryHasRepository(log = True)
stgit/completion.py new file +140 -0
140 lines not on this page · raw message
2008/9/21 Karl Hasselström <[email protected]>:
Quoted 3 lines
Just pushed out the stack log stuff to kha/safe. It really should be ready for wider use at this point, and it was getting tiresome to keep rebasing it.
Great work, I merged (most of) it. Many thanks.
Quoted 2 lines
One patch is still in experimental -- it depends on a new git feature that isn't in any release yet.
[...]
Quoted 1 line
Read several objects at once with git cat-file --batch
I skipped this one for now. I'm using Ubuntu (Hardy) and the git version is 1.5.4.3. I would wait until we get at least a stable git release with this feature.
I haven't looked in detail but can we have a way to drop back to the old implementation if the option isn't available?
Signature · 1 line
Catalin
Quoted 7 lines · Catalin Marinas
2008/9/21 Karl Hasselström <[email protected]>:
Quoted 3 lines
Just pushed out the stack log stuff to kha/safe. It really should be ready for wider use at this point, and it was getting tiresome to keep rebasing it.
Great work, I merged (most of) it. Many thanks.
Thanks.
Quoted 6 lines
Quoted 2 lines
One patch is still in experimental -- it depends on a new git feature that isn't in any release yet.
[...]
Quoted 1 line
Read several objects at once with git cat-file --batch
I skipped this one for now.
I was talking about kha/experimental~0 here; you're talking about kha/safe~0, which is kha/experimental~1. But never mind.
Quoted 2 lines
I'm using Ubuntu (Hardy) and the git version is 1.5.4.3. I would wait until we get at least a stable git release with this feature.
I'm using it too, but I always build my own git, so I never know what version the system comes with ... but I see your point. I'll put that patch back in kha/experimental for now.
Quoted 2 lines
I haven't looked in detail but can we have a way to drop back to the old implementation if the option isn't available?
I guess in this case we could, since if the option exists, we can use it. (The second patch is not so lucky; the flag exists since quite a while, but lacks a feature in older gits.)
Since it's just a moderate speed-up in both cases, I'm kind of inclined to just wait for relevant distributions to catch up, and avoid all the hassle.
Signature · 2 lines
Karl Hasselström, [email protected] www.treskal.com/kalle