stgit
17 years agoUse FETCH_HEAD to know where to rebase to after pull. master
Yann Dirson [Sat, 3 Feb 2007 21:29:30 +0000 (22:29 +0100)]
Use FETCH_HEAD to know where to rebase to after pull.

Since 'git fetch' already takes care of the branch.*.merge parameters,
resolves the new tip of the parent branch and puts it in FETCH_HEAD,
we're better just taking it from there.

This fixes the regression on t1200-push-modified.sh.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoWarn the user when there is no parent information in the config.
Yann Dirson [Sat, 3 Feb 2007 16:04:25 +0000 (17:04 +0100)]
Warn the user when there is no parent information in the config.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoCorrectly check the pull-does-rebase parameter in 'stg pull'.
Yann Dirson [Sat, 3 Feb 2007 16:04:20 +0000 (17:04 +0100)]
Correctly check the pull-does-rebase parameter in 'stg pull'.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoAllow .git/branches and .git/remotes to be missing
Pavel Roskin [Fri, 2 Feb 2007 17:18:40 +0000 (17:18 +0000)]
Allow .git/branches and .git/remotes to be missing

Both directories are now obsoleted by .git/config file.  This fixes
"make test" in StGIT with git 1.5.0-rc3.

Signed-off-by: Pavel Roskin <proski@gnu.org>
17 years agoDo not return 'origin' as parent remote when there is no such remote.
Yann Dirson [Fri, 2 Feb 2007 17:18:40 +0000 (17:18 +0000)]
Do not return 'origin' as parent remote when there is no such remote.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoRebase to parent branch after git-fetch in "stg pull".
Yann Dirson [Fri, 2 Feb 2007 17:18:40 +0000 (17:18 +0000)]
Rebase to parent branch after git-fetch in "stg pull".

Previously we were just assuming that the remote from which we
just failed defined a local branch whose name was the same as the
remote def, and that this branch was the parent.  While this is true
for the most common case (branch "origin" from remote "origin"), it is
quite an unflexible assumption.

Also move the rebasing from git.pull to commands.pull.func since that
is clearly stgit-level stuff, and rename git.pull() to git.fetch() to
match default behaviour.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoThe user does not want to mess with the refspecs.
Yann Dirson [Fri, 2 Feb 2007 17:18:40 +0000 (17:18 +0000)]
The user does not want to mess with the refspecs.

The only use I know of for this parameter is 'stg pull . <branch>',
for which 'stg rebase <branch>' should be used instead.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoCheck for invalid patch names before acting
Catalin Marinas [Fri, 2 Feb 2007 17:18:40 +0000 (17:18 +0000)]
Check for invalid patch names before acting

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoset() is not a builtin function in Python 2.3
Catalin Marinas [Thu, 1 Feb 2007 22:52:02 +0000 (22:52 +0000)]
set() is not a builtin function in Python 2.3

This patch uses the sets.Set class rather than the builtin function.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFixes to doc strings.
Yann Dirson [Thu, 1 Feb 2007 22:52:02 +0000 (22:52 +0000)]
Fixes to doc strings.

At least the docstring for "branch" is still very confusing, but
that's hard to fix.  We'll likely have to wait for the post-1.0
command-line redesign.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoMake 'stg pull' use git-fetch and not git-pull.
Yann Dirson [Wed, 31 Jan 2007 23:41:11 +0000 (23:41 +0000)]
Make 'stg pull' use git-fetch and not git-pull.

We introduce a new pull-does-rebase setting, as companion to pullcmd.
This allows to use both pullcmd's that need a rebase (like git-fetch)
and pullcmd's that do not (like git-pull).

To be able to rebase, we rely on parent information being available
for the stack.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoHave 'stg branch --create' record parent information.
Yann Dirson [Wed, 31 Jan 2007 23:34:06 +0000 (23:34 +0000)]
Have 'stg branch --create' record parent information.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoBasic support for keeping a ref to the parent branch.
Yann Dirson [Wed, 31 Jan 2007 23:27:55 +0000 (23:27 +0000)]
Basic support for keeping a ref to the parent branch.

This adds a framework to handle the parent branch of a stack, in
addition to the parent remote, and to set them when creating a stack.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoAllows extraction of information about remotes.
Yann Dirson [Wed, 31 Jan 2007 23:15:38 +0000 (23:15 +0000)]
Allows extraction of information about remotes.

We want to know the list of declared remotes, the local branches they
hold, and which remotes holds a given branch.  All this regardless of
where the information is stored.

If there are any git-1.5 remotes declared in .git/config, we suppose
you know what you're doing and they will take precedence on any
pre-1.5 remotes.

This does not use git-remote for now, since it is 1.5 material not
released yet, does not support legacy branches/ remotes, and does not
allow yet to query all of the information we need.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoMove identification of parent branch's remote def up into stack class.
Yann Dirson [Wed, 31 Jan 2007 23:15:38 +0000 (23:15 +0000)]
Move identification of parent branch's remote def up into stack class.

Also adds the __set_parent_remote() counterpart method, but only
private since it is expected to be called only through set_parent, to
be introduced in subsequent patch.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoAdd caching to the new config class.
Yann Dirson [Wed, 31 Jan 2007 23:15:38 +0000 (23:15 +0000)]
Add caching to the new config class.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoMake stgit.config use git-repo-config.
Yann Dirson [Wed, 31 Jan 2007 23:15:38 +0000 (23:15 +0000)]
Make stgit.config use git-repo-config.

This is an initial implementation without any sort of caching.  If we
want that, we could do it with this new API.  We could even just
simply generalize the use of ConfigOption instead.

I just copypasted __run from stgit.git to avoid too much work, but
it's definitely something to cleanup.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoMake the 'series --short' length configurable
Catalin Marinas [Fri, 26 Jan 2007 22:29:10 +0000 (22:29 +0000)]
Make the 'series --short' length configurable

The 'shortnr' config option was added so that one can set a different
length than the default 5.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd support to hide and unhide patches
Catalin Marinas [Fri, 26 Jan 2007 22:29:10 +0000 (22:29 +0000)]
Add support to hide and unhide patches

Hidden patches are only listed with 'series' -a or -i options.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years ago'--showbranch' and '--noprefix' options for 'series'
Catalin Marinas [Thu, 25 Jan 2007 22:28:39 +0000 (22:28 +0000)]
'--showbranch' and '--noprefix' options for 'series'

This option modify the display of patches in 'series'. Useful for
scripting.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow a patch range to be specified for 'series'
Catalin Marinas [Thu, 25 Jan 2007 22:28:39 +0000 (22:28 +0000)]
Allow a patch range to be specified for 'series'

If a patch range is specified, the series will only show those
files. Useful for scripting.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoHide the test_create_repo output
Catalin Marinas [Thu, 25 Jan 2007 22:28:38 +0000 (22:28 +0000)]
Hide the test_create_repo output

git-init-db now prints some info when initialising a tree, just hide
it in the test scripts, unless --verbose was specified.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoSynchronise the current patch if none specified for 'sync'
Catalin Marinas [Thu, 25 Jan 2007 22:28:38 +0000 (22:28 +0000)]
Synchronise the current patch if none specified for 'sync'

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix the displaying of unknown files for 'stg status'
Catalin Marinas [Sun, 21 Jan 2007 23:24:56 +0000 (23:24 +0000)]
Fix the displaying of unknown files for 'stg status'

Unknown files (marked with '?' by "stg status") are all displayed
regardless of any files or dir explicitely specified on command-line.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd new 'rebase' command.
Yann Dirson [Sat, 20 Jan 2007 18:04:21 +0000 (19:04 +0100)]
Add new 'rebase' command.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoTrack the files conflict history
Catalin Marinas [Fri, 12 Jan 2007 23:10:44 +0000 (23:10 +0000)]
Track the files conflict history

This commit refreshes a pushed patch even if there was a conflict (in
which case only the correctly merged files are merged). The refresh
after fixing the conflict would log the conflict files in the patch
history.

The patch also updates the index in the case of the interactive merge.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd option to automatically invoke the interactive merger
Catalin Marinas [Wed, 10 Jan 2007 19:38:26 +0000 (19:38 +0000)]
Add option to automatically invoke the interactive merger

The 'autoimerge' option was added (defaulting to 'no') to
automatically invoke the interactive merging tool when a conflict
occurs.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow e-mail aliases for the "mail" command
Catalin Marinas [Wed, 10 Jan 2007 19:38:26 +0000 (19:38 +0000)]
Allow e-mail aliases for the "mail" command

The addresses passed via options or in the template file can also be
aliases stored in the [aliases] section of the configuration
file. They get expanded automatically when building the patch or cover
e-mails.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoIndent the example gitconfig file
Catalin Marinas [Wed, 10 Jan 2007 19:38:25 +0000 (19:38 +0000)]
Indent the example gitconfig file

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoCheck git pull remote before defaulting to 'origin'
Pavel Roskin [Wed, 10 Jan 2007 19:38:25 +0000 (19:38 +0000)]
Check git pull remote before defaulting to 'origin'

Check git pull remote before defaulting to 'origin'

Signed-off-by: Pavel Roskin <proski@gnu.org>
17 years agoPipe the 'patches --diff' output through the pager
Catalin Marinas [Wed, 10 Jan 2007 19:38:25 +0000 (19:38 +0000)]
Pipe the 'patches --diff' output through the pager

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix the branch renaming to also rename the reflogs
Catalin Marinas [Thu, 4 Jan 2007 19:30:18 +0000 (19:30 +0000)]
Fix the branch renaming to also rename the reflogs

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd '--missing' option to 'series'
Catalin Marinas [Thu, 4 Jan 2007 19:30:18 +0000 (19:30 +0000)]
Add '--missing' option to 'series'

This option lists the patches on a remote branch which are missing
from the current branch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix the bash completion when there is no patch applied
Catalin Marinas [Wed, 13 Dec 2006 17:10:40 +0000 (17:10 +0000)]
Fix the bash completion when there is no patch applied

When there aren't any patches applied, the
.git/patches/<branch>/current file is removed and the bash completion
script fails to read it.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow the mail command to send unapplied patches as well
Catalin Marinas [Tue, 12 Dec 2006 22:07:17 +0000 (22:07 +0000)]
Allow the mail command to send unapplied patches as well

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd the --unapplied option to pick
Catalin Marinas [Tue, 12 Dec 2006 22:07:17 +0000 (22:07 +0000)]
Add the --unapplied option to pick

This option picks a commit id but doesn't actually apply it to the
stack (also useful for duplicating patches).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoThe author's address is incorrect in setyp.py
Pavel Roskin [Mon, 11 Dec 2006 22:21:12 +0000 (22:21 +0000)]
The author's address is incorrect in setyp.py

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow the abbreviation of StGIT commands
Catalin Marinas [Mon, 11 Dec 2006 22:21:11 +0000 (22:21 +0000)]
Allow the abbreviation of StGIT commands

If a partial command name is given, StGIT tries to find a unique
match, otherwise it fails.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoDon't always use git-merge-recursive because of speed
Catalin Marinas [Fri, 8 Dec 2006 22:31:52 +0000 (22:31 +0000)]
Don't always use git-merge-recursive because of speed

There are situations like picking patches, folding a patch onto a base
or synchronising patches where the distance between base and heads is
in general small. In this case, git-read-tree --aggressive is much
faster. We currently use the recursive merge when picking or pushing a
patch (the base change might involve some renames).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd the 'sync' command
Catalin Marinas [Thu, 7 Dec 2006 22:02:42 +0000 (22:02 +0000)]
Add the 'sync' command

This command is used to keep patches on several branches/trees in
sync.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoMake 'push --undo' safer
Catalin Marinas [Thu, 7 Dec 2006 22:02:42 +0000 (22:02 +0000)]
Make 'push --undo' safer

Make the push undoing a bit safer by asking the user to first clean
the local changes or conflicts rather than silently resetting them.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix a merge case with files added in both heads but different
Catalin Marinas [Thu, 7 Dec 2006 22:02:41 +0000 (22:02 +0000)]
Fix a merge case with files added in both heads but different

Since using git-merge-recursive instead of git-read-tree, the local
file is removed if it was added in both heads but different. We now
re-generated it in gitmergeonefile.merge. The patch also cleans the
working directory of extra files generated by git-merge-recursive
since our own merge re-generates them with nicer naming.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoPrint 'refresh done' before pushing other patches
Catalin Marinas [Thu, 7 Dec 2006 22:02:40 +0000 (22:02 +0000)]
Print 'refresh done' before pushing other patches

This is for the case where --patch was specified

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoPipe the 'stg help <command>' output through the pager
Catalin Marinas [Wed, 6 Dec 2006 22:12:15 +0000 (22:12 +0000)]
Pipe the 'stg help <command>' output through the pager

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow patch ranges for the 'pop' command
Catalin Marinas [Wed, 6 Dec 2006 22:12:14 +0000 (22:12 +0000)]
Allow patch ranges for the 'pop' command

This patch is to make 'pop' accept patch ranges. Only the patches
specified in the range are now popped from the stack, the command
performing the necessary pop/push operations.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow ranges for the 'export' command
Catalin Marinas [Wed, 6 Dec 2006 22:12:14 +0000 (22:12 +0000)]
Allow ranges for the 'export' command

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>
17 years agoFix the 'clean' command not to pop all the patches
Catalin Marinas [Wed, 6 Dec 2006 22:12:13 +0000 (22:12 +0000)]
Fix the 'clean' command not to pop all the patches

With this patch, the 'clean' command only pops to the first empty
patch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFlush the stdout in the commit command
Catalin Marinas [Tue, 5 Dec 2006 22:07:24 +0000 (22:07 +0000)]
Flush the stdout in the commit command

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix "series -d" when the patch description is empty
Catalin Marinas [Tue, 5 Dec 2006 22:07:24 +0000 (22:07 +0000)]
Fix "series -d" when the patch description is empty

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow the cloning of branches not under StGIT control
Catalin Marinas [Tue, 5 Dec 2006 22:07:24 +0000 (22:07 +0000)]
Allow the cloning of branches not under StGIT control

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoDocument some current bugs and add to the TODO list.
Yann Dirson [Tue, 5 Dec 2006 22:07:23 +0000 (22:07 +0000)]
Document some current bugs and add to the TODO list.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoCreate a StgitObject class to factorise code for property handling.
Yann Dirson [Tue, 5 Dec 2006 22:07:23 +0000 (22:07 +0000)]
Create a StgitObject class to factorise code for property handling.

This change makes it easier to add new stored fields to the Series object,
without having to duplicate existing code from Patch.

Generic field accessors were taken from the Patch class.  Dir accessors
were added to avoid making the __dir attribute public, and were used
to replace Series::__series_dir (that name was a bit redundant anyway).
Create_empty_field came as a natural addition to factorise more code.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoAsk git for author and committer name
Karl Hasselström [Tue, 5 Dec 2006 22:07:23 +0000 (22:07 +0000)]
Ask git for author and committer name

(patch modified by Catalin Marinas)

Consistently do the following to get hold of default user, author and
committer:

  1. Use the value specified on the command line, if any.

  2. Otherwise, use the environment variables, if any.

  3. Otherwise, read the configuration files

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoSet HOME to the test directory to avoid reading ~/.stgitrc
Pavel Roskin [Tue, 5 Dec 2006 22:07:22 +0000 (22:07 +0000)]
Set HOME to the test directory to avoid reading ~/.stgitrc

This makes the tests more system independent and allows better testing
for "stg mail" command.

Signed-off-by: Pavel Roskin <proski@gnu.org>
17 years agoOnly print the progress message if on a TTY
Catalin Marinas [Tue, 5 Dec 2006 22:07:22 +0000 (22:07 +0000)]
Only print the progress message if on a TTY

The "Checking for changes..." message should only be printed if stdout
is a TTY to avoid unnecessary information for people redirecting the
output to a file.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoUse gitconfig rather than stgirc
Catalin Marinas [Tue, 5 Dec 2006 22:07:22 +0000 (22:07 +0000)]
Use gitconfig rather than stgirc

This patch enables the use of gitconfig files (~/.gitconfig or
.git/config) rather than stgitrc. These files can have a [stgit]
section. Currently, the git config lines have to be stripped since the
options are prepended with spaces.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoMore config examples.
Yann Dirson [Tue, 5 Dec 2006 22:07:21 +0000 (22:07 +0000)]
More config examples.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoComplete patch names after a patch (range) option
Catalin Marinas [Fri, 24 Nov 2006 22:57:56 +0000 (22:57 +0000)]
Complete patch names after a patch (range) option

Commands like export, refresh and diff have options that take a patch
argument. Modify the bash completion script to allow this.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllows to refresh a non-top applied patch.
Yann Dirson [Fri, 24 Nov 2006 22:57:55 +0000 (22:57 +0000)]
Allows to refresh a non-top applied patch.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoBomb out when --ack and --sign are both passed to "refresh".
Yann Dirson [Fri, 24 Nov 2006 22:57:55 +0000 (22:57 +0000)]
Bomb out when --ack and --sign are both passed to "refresh".

Old behaviour was silently ignoring --ack, which could be confusing.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoOptimize stg goto in the pop case.
Yann Dirson [Fri, 24 Nov 2006 22:57:54 +0000 (22:57 +0000)]
Optimize stg goto in the pop case.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoMake Series::patch_applied public.
Yann Dirson [Fri, 24 Nov 2006 22:57:54 +0000 (22:57 +0000)]
Make Series::patch_applied public.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoAdd a boundary to parse_patches()
Catalin Marinas [Wed, 22 Nov 2006 20:14:58 +0000 (20:14 +0000)]
Add a boundary to parse_patches()

This is useful since specifying the ".." range would generate all the
applied and unapplied patches for commands like "show" and
"delete". With this patch, the boundary is crossed only if
specifically asked (i.e. the first and last patch of the range are on
each side of the boundary).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow 'show' to display many patches
Catalin Marinas [Wed, 22 Nov 2006 20:14:57 +0000 (20:14 +0000)]
Allow 'show' to display many patches

The show command should be allowed to display more than one patch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix a bug in gitmergeonefile.py introduced recently
Catalin Marinas [Mon, 20 Nov 2006 21:45:17 +0000 (21:45 +0000)]
Fix a bug in gitmergeonefile.py introduced recently

The bug was introduced by the change of merger and keeporig variables
from string to ConfigOption.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoOnly read the config files when running a command
Catalin Marinas [Fri, 17 Nov 2006 22:20:40 +0000 (22:20 +0000)]
Only read the config files when running a command

This reduces the time to display the help by about 12ms (on my PC).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd a 'sender' configuration option
Catalin Marinas [Fri, 17 Nov 2006 22:20:40 +0000 (22:20 +0000)]
Add a 'sender' configuration option

This variable is expanded in the e-mail templates on the 'From:'
header line. It replaces the current 'maintainer' variable. This code
will undergo some reworking as there are pending patches affecting it.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoOnly create a 'From: author' line if needed
Catalin Marinas [Fri, 17 Nov 2006 22:20:39 +0000 (22:20 +0000)]
Only create a 'From: author' line if needed

When the sender is the same as the author, there is no need to add a
'From:' line to the patch description.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoEdit the cover or patch message before e-mail encoding
Catalin Marinas [Thu, 16 Nov 2006 19:45:32 +0000 (19:45 +0000)]
Edit the cover or patch message before e-mail encoding

This is needed because the user might introduce characters not handled
by the current encoding and StGIT could no longer change it. The
disadvantage is that not all the e-mail headers are visible in the
editor but users shouldn't manually modify them anyway.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoUpdate the bash-completion script
Catalin Marinas [Thu, 16 Nov 2006 19:45:32 +0000 (19:45 +0000)]
Update the bash-completion script

This version automatically gets the command options and also has support
for more commands taking patch ranges.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoReduce the imports in stgit/main.py
Catalin Marinas [Thu, 16 Nov 2006 19:45:32 +0000 (19:45 +0000)]
Reduce the imports in stgit/main.py

Some module are only needed when executing a command and not when just
invoking the help. This reduces the delay slightly, useful for stgit bash
completion.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoStGIT bash completion
Karl Hasselström [Thu, 16 Nov 2006 19:45:31 +0000 (19:45 +0000)]
StGIT bash completion

A minimal bash completion script for StGIT. It completes the
subcommand names, and options and patch names for some subcommands.

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoFix the mail import regex to remove the [...PATCH...] text
Catalin Marinas [Thu, 16 Nov 2006 19:45:31 +0000 (19:45 +0000)]
Fix the mail import regex to remove the [...PATCH...] text

With the addition of a prefix to the [PATCH] string, the mail
importing regex was no longer able to remove it.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoRegression test for "stg mail"
Karl Hasselström [Thu, 16 Nov 2006 19:45:30 +0000 (19:45 +0000)]
Regression test for "stg mail"

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoRegression test for "stg import"
Karl Hasselström [Thu, 16 Nov 2006 19:45:30 +0000 (19:45 +0000)]
Regression test for "stg import"

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoDon't mention deprecated template variables
Karl Hasselström [Thu, 16 Nov 2006 19:45:29 +0000 (19:45 +0000)]
Don't mention deprecated template variables

%(endofheaders)s and %(date)s are deprecated and expand to the empty
string, so don't mention them in the help text.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoPrint progress message to stderr, not stdout
Karl Hasselström [Thu, 16 Nov 2006 19:45:28 +0000 (19:45 +0000)]
Print progress message to stderr, not stdout

Printing progress messages to stdout causes them to get mixed up with
the actual output of the program. Using stderr is much better, since
the user can then redirect the two components separately.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd file renaming support
Catalin Marinas [Wed, 8 Nov 2006 17:35:50 +0000 (17:35 +0000)]
Add file renaming support

The merge method was changed from gitmergeonefile.merge() to the external
git-merge-recursive which handles renames properly. The 'mv' command was
added as well.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoOptionally repack the object repository after every pull
Chuck Lever [Wed, 8 Nov 2006 22:30:03 +0000 (22:30 +0000)]
Optionally repack the object repository after every pull

Add an option to .stgitrc which causes the object repository to be repacked
after every "stg pull" operation.  Especially on NFS, this improves overall
performance considerably.  The only downside is that the first time it runs
it will take a very long time if the repository hasn't been packed
recently.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
17 years agoAdd a new option to "stg applied" and "stg unapplied" that provides a count
Chuck Lever [Wed, 8 Nov 2006 22:30:03 +0000 (22:30 +0000)]
Add a new option to "stg applied" and "stg unapplied" that provides a count

of patches rather than a list.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
17 years agoPrint a message while checking for changes in the working directory.
Chuck Lever [Wed, 8 Nov 2006 22:30:02 +0000 (22:30 +0000)]
Print a message while checking for changes in the working directory.

Helpful on slow file systems such as NFS.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
17 years agoAdd mbox support to "import"
Catalin Marinas [Wed, 8 Nov 2006 22:30:02 +0000 (22:30 +0000)]
Add mbox support to "import"

This patch allows the "import" command to read an mbox file. It also fixes
various bugs and modifies git.apply_patch() to dump the failed patch to
the .stgit-failed.patch file for easy inspection or manual applying.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd a trash directory with deleted patches
Catalin Marinas [Wed, 8 Nov 2006 22:30:02 +0000 (22:30 +0000)]
Add a trash directory with deleted patches

Since the delete command now supports multiple patches (and a ".." would
remove the whole stack), it is safer to copy the commit ids to
.git/patches/<branch>/trash/ in case a restore is needed. There is no
command allowing the restoring yet.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd support for multipart messages to import
Catalin Marinas [Tue, 7 Nov 2006 19:03:49 +0000 (19:03 +0000)]
Add support for multipart messages to import

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoProperly import qp-encoded e-mail headers
Catalin Marinas [Tue, 7 Nov 2006 19:03:49 +0000 (19:03 +0000)]
Properly import qp-encoded e-mail headers

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoProperly encode the e-mail headers and body
Catalin Marinas [Tue, 7 Nov 2006 19:03:48 +0000 (19:03 +0000)]
Properly encode the e-mail headers and body

The headers are QP-encoded and the body is left as utf-8. The mail command
now uses the email Python package for setting the headers and encoding. The
template files were modified as there is no need for "Date:" and
"%(endofheaders)s".

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoGenerate unique patch names
Karl Hasselström [Tue, 7 Nov 2006 19:03:48 +0000 (19:03 +0000)]
Generate unique patch names

"stg assimilate" was already making sure that automatically generated
patch names were non-empty and unique, by suffixing them with a dash
and a number if necessary. This patch moves that functionality into
the autogeneration function itself, so that all its callers can
benefit from it (and the user can benefit from uniform behavior from
all stgit commands).

As an added bonus, this permits the removal of a number of checks that
would abort with an error if the automatically generated name was
empty.

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoGenerate shorter patch names
Karl Hasselström [Tue, 7 Nov 2006 19:03:47 +0000 (19:03 +0000)]
Generate shorter patch names

Not all commits are blessed with a really short first-line summary in
their commit messages. This means that we shouldn't blindly take the
entire first line of the comment, since that sometimes results in
truly spectacular patch names.

I chose 30 characters as a reasonable value, considering that we don't
yet have any tab-completion on patch names. There's probably not much
point in making it configurable.

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoSlightly change the multiple patches delete function
Catalin Marinas [Thu, 2 Nov 2006 21:18:33 +0000 (21:18 +0000)]
Slightly change the multiple patches delete function

The function now first checks whether it can do the operation (i.e. the
applied patches are in consecutive reverse order starting from topmost)
before performing any deletes. It also eliminates the need to check for
local changes with every delete or when the operation is targetted to a
different branch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow deletion of several patches at once
Karl Hasselström [Thu, 2 Nov 2006 21:18:33 +0000 (21:18 +0000)]
Allow deletion of several patches at once

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoFixes "stg goto `stg top`" to no-op & adds test
Ilpo Järvinen [Thu, 2 Nov 2006 21:18:32 +0000 (21:18 +0000)]
Fixes "stg goto `stg top`" to no-op & adds test

Please forgive me that didn't read the test metadata through while
producing the last patch. This time also it should be correct...

StGIT tried to access index that is not valid when goto'ing to
the current patch. Adds also a test for it.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
17 years agoAllow hand-editing of patches before sending
Karl Hasselström [Thu, 2 Nov 2006 21:18:32 +0000 (21:18 +0000)]
Allow hand-editing of patches before sending

This adds a new flag to 'stg mail', allowing the user to hand-edit
each patch e-mail before it is sent, just like it is currently
possible to edit the cover message.

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoBash snippet to show branch and patch in bash prompt
Robin Rosenberg [Thu, 2 Nov 2006 21:18:32 +0000 (21:18 +0000)]
Bash snippet to show branch and patch in bash prompt

Modified according to Eran Tromer's suggestions. Also added some personal
preference to the default PS1 but people should really adapt this to their
needs.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
17 years agoClean-up the number of imports in main.py
Catalin Marinas [Thu, 2 Nov 2006 21:18:32 +0000 (21:18 +0000)]
Clean-up the number of imports in main.py

This is needed to reduce the start-up time to about a half. Only the module
for the given command is loaded.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoStgit: allow importing series files where patch names include slashes
Paolo 'Blaisorblade' Giarrusso [Thu, 2 Nov 2006 21:18:31 +0000 (21:18 +0000)]
Stgit: allow importing series files where patch names include slashes

Do that by converting slashes in patch name to dashes. Actually one could think
that different quilt folders relate to topic branches, but I do not see an
obviously correct mapping nor users which would do that.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
17 years agoAdd the 'autobcc' config option
Catalin Marinas [Fri, 27 Oct 2006 20:20:27 +0000 (21:20 +0100)]
Add the 'autobcc' config option

Useful to automatically bcc the e-mails to a given address.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd an optional prefix to the PATCH subject when mailing.
Robin Rosenberg [Fri, 27 Oct 2006 20:20:26 +0000 (21:20 +0100)]
Add an optional prefix to the PATCH subject when mailing.

This is for submitting patches to mailing lists with multiple
projects.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoRegression test for "stg assimilate"
Karl Hasselström [Wed, 25 Oct 2006 19:24:55 +0000 (20:24 +0100)]
Regression test for "stg assimilate"

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoNew stg command: assimilate
Karl Hasselström [Wed, 25 Oct 2006 19:24:55 +0000 (20:24 +0100)]
New stg command: assimilate

Introduce an "assimilate" command, with no options. It takes any GIT
commits committed on top of your StGIT patch stack and converts them
into StGIT patches.

Also change the error message when an StGIT command can't do its job
because there are GIT commits on top of the stack. Instead of
recommending "refresh -f", which is a destructive operation, recommend
"assimilate", which is not.

NOTE: "assimilate" currently refuses to work its magic if it
encounters a merge commit. This is reasonable, since merge commits
can't (yet) be represented as StGIT patches. However, it would be
possible (and well-defined) to replace the merge commit with a regular
commit on the branch with the same end result (tree object),
discarding all the parents that aren't on our branch. But this would
take a substantial amount of code, and is of dubious value, so for now
"assimilate" just cries bloody murder if it finds a merge.

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoDisregard extraneous arguments when providing help
Karl Hasselström [Wed, 25 Oct 2006 19:24:54 +0000 (20:24 +0100)]
Disregard extraneous arguments when providing help

"stg --help pop" prints the help text for pop, but "stg --help pop
foo" just prints the list of commands. That's silly, so fix it by
simply ignoring the extra arguments.

Signed-off-by: Karl Hasselström <kha@treskal.com>