stgit
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>
17 years agoWhen no command was given, print usage message
Karl Hasselström [Wed, 25 Oct 2006 19:24:54 +0000 (20:24 +0100)]
When no command was given, print usage message

It's just silly to say "Unknown command" when the user didn't give a
command. Better to tell her to use a command.

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoLet "stg help" be like "stg --help"
Karl Hasselström [Wed, 25 Oct 2006 19:24:54 +0000 (20:24 +0100)]
Let "stg help" be like "stg --help"

"stg --help" prints the list of commands, but "stg help" just prints
the usage message for the help command. This may be useful in theory,
but the distinction is probably lost on 95% of all users (and the
remaining 5% probably don't need to see the usage message for the help
command anyway, since they know how it works). So just make both
commands output the helpful command list.

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoRelease 0.11 v0.11
Catalin Marinas [Sat, 21 Oct 2006 08:42:19 +0000 (09:42 +0100)]
Release 0.11

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd Debian package support to StGIT
Catalin Marinas [Fri, 20 Oct 2006 20:48:32 +0000 (21:48 +0100)]
Add Debian package support to StGIT

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoRearrange the patches with a given series file
Catalin Marinas [Fri, 20 Oct 2006 20:48:32 +0000 (21:48 +0100)]
Rearrange the patches with a given series file

This patch adds the --series option to the float command to reorder the
(top) patches as specified in a series file (or standard input).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd --auto option to 'mail'
Catalin Marinas [Fri, 20 Oct 2006 20:48:32 +0000 (21:48 +0100)]
Add --auto option to 'mail'

This option causes the mail command to automatically add the patch signers
to the Cc list. The patch also fixes the multiple To/Cc/Bcc lines
generation.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow the git-pull command to be configurable
Catalin Marinas [Fri, 20 Oct 2006 20:48:32 +0000 (21:48 +0100)]
Allow the git-pull command to be configurable

This way some people can use cg-pull instead. The patch also does some
clean-up in the example stgitrc file.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd the diffcol.sh file to the contrib directory
Catalin Marinas [Fri, 20 Oct 2006 20:48:30 +0000 (21:48 +0100)]
Add the diffcol.sh file to the contrib directory

This script is a pager for colourifying the diff output. Copied from Quilt.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoNew command 'float' to move a patch to the top
Robin Rosenberg [Tue, 17 Oct 2006 18:39:53 +0000 (19:39 +0100)]
New command 'float' to move a patch to the top

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix the --cover option.
Robin Rosenberg [Tue, 17 Oct 2006 18:37:26 +0000 (19:37 +0100)]
Fix the --cover option.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix the preserving of the local changes during pop
Catalin Marinas [Tue, 17 Oct 2006 18:37:26 +0000 (19:37 +0100)]
Fix the preserving of the local changes during pop

The operation now only preserves the local changes by reverse-applying the
diff of the popped patches.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd --sign and --ack options to refresh
Catalin Marinas [Mon, 16 Oct 2006 18:36:49 +0000 (19:36 +0100)]
Add --sign and --ack options to refresh

These options automatically sign or acknowledge a patch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd the '--interactive' option to 'resolved'
Catalin Marinas [Mon, 16 Oct 2006 18:36:49 +0000 (19:36 +0100)]
Add the '--interactive' option to 'resolved'

This options causes the 'resolved' command to run an interactive merge tool
like xxdiff or emacs, defined by the 'imerger' variable in the .stgitrc
config file.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoTODO list update
Catalin Marinas [Fri, 15 Sep 2006 18:24:02 +0000 (19:24 +0100)]
TODO list update

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd the --noreply option to 'mail'
Catalin Marinas [Fri, 15 Sep 2006 18:24:02 +0000 (19:24 +0100)]
Add the --noreply option to 'mail'

There are mailing lists (ARM Linux Kernel is one of them) that filter out
e-mails having the In-Reply-To: header but a subject line not starting with
Re:. With this option, the mail command will not create the reply-specific
headers (the patch series will be unthreaded).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd patch history support
Catalin Marinas [Fri, 15 Sep 2006 18:24:02 +0000 (19:24 +0100)]
Add patch history support

The patch history tracking works by generating a chain of log commits for
the corresponding patch commits. A 'log' command is available to either
list the changelog or invoke gitk.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd the --graphical option to series
Catalin Marinas [Fri, 15 Sep 2006 18:24:01 +0000 (19:24 +0100)]
Add the --graphical option to series

This option invokes gitk on all the patches rather than printing the
series.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow empty commit messages
Catalin Marinas [Fri, 15 Sep 2006 18:24:01 +0000 (19:24 +0100)]
Allow empty commit messages

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd --keep option to pop
Catalin Marinas [Sun, 10 Sep 2006 13:58:54 +0000 (14:58 +0100)]
Add --keep option to pop

This option allows popping patches without affecting the working directory.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoUse get-ref-list to get the commit parents
Catalin Marinas [Sun, 10 Sep 2006 13:56:38 +0000 (14:56 +0100)]
Use get-ref-list to get the commit parents

Thanks to Yann Dirson for submitting the initial patch. The patch was
modified to only call git-rev-list when the commit parents are
required, otherwise operations like 'push' would be slowed down.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd a --parent flag to "stgit pick".
Yann Dirson [Mon, 14 Aug 2006 16:55:42 +0000 (18:55 +0200)]
Add a --parent flag to "stgit pick".

This is useful to pick changes from a non-stgit branch, that were
recorded as a merge commit, while giving control on the parent to
use as "bottom" for the patch (for some reason stgit selects the
first parent by default).

Incidentally, it can be used to pick changes between arbitrary
trees in the revision graph.  Since that can be useful as well,
I did not implement the is_parent check I originally meant to add.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoUse the ".." syntax for patch ranges
Catalin Marinas [Fri, 11 Aug 2006 16:32:33 +0000 (17:32 +0100)]
Use the ".." syntax for patch ranges

This patch also adapt the push/mail/diff/export commands to the new
syntax.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoSet the .txt extension to the StGIT commit message file
Catalin Marinas [Fri, 11 Aug 2006 16:32:31 +0000 (17:32 +0100)]
Set the .txt extension to the StGIT commit message file

The original extension was .msg which editors like emacs couldn't guess.
The patch changes it to .txt.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAutomatically generate patch names for uncommit
Catalin Marinas [Fri, 14 Jul 2006 16:25:36 +0000 (17:25 +0100)]
Automatically generate patch names for uncommit

This is the same as in the pick or import commands, the patch name, if not
specified, is automatically generated from the first line of the patch
description.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd a common function for reading template files
Catalin Marinas [Mon, 10 Jul 2006 21:21:22 +0000 (22:21 +0100)]
Add a common function for reading template files

Useful to search through various directories without duplicating the code.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd '--' to git-diff-index calls
Catalin Marinas [Wed, 5 Jul 2006 18:27:02 +0000 (19:27 +0100)]
Add '--' to git-diff-index calls

Without this, git-diff-index was confused about the command line arguments
and commands like 'push --undo' and 'status --reset' failed to work
properly.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoGet the patch name from the description
Catalin Marinas [Wed, 5 Jul 2006 18:27:02 +0000 (19:27 +0100)]
Get the patch name from the description

The import and pick commands can get the patch name from the patch
description if it wasn't passed on the command line or the patch is read
from the standard input (for import).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoDo not use the pager when the output is empty
Catalin Marinas [Wed, 5 Jul 2006 18:27:02 +0000 (19:27 +0100)]
Do not use the pager when the output is empty

This is for the diff and show commands to not run the output through the
pager if there is nothing to display.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoRelease 0.10 v0.10
Catalin Marinas [Sun, 11 Jun 2006 12:21:04 +0000 (13:21 +0100)]
Release 0.10

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoUpdate the TODO file
Catalin Marinas [Sun, 11 Jun 2006 12:21:02 +0000 (13:21 +0100)]
Update the TODO file

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix the t0001-subdir-branches.sh test
Catalin Marinas [Sun, 11 Jun 2006 12:16:26 +0000 (13:16 +0100)]
Fix the t0001-subdir-branches.sh test

It was using 'stg add <file>' without any patches applied. This now fails.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix the add and rm commands to fail if no patch is applied
Catalin Marinas [Sun, 11 Jun 2006 12:12:39 +0000 (13:12 +0100)]
Fix the add and rm commands to fail if no patch is applied

They were just adding the file without complaining.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoGenerate an empty commit for the newly created patches
Catalin Marinas [Sun, 11 Jun 2006 12:12:30 +0000 (13:12 +0100)]
Generate an empty commit for the newly created patches

This way, 'stg show' will no longer display the previous patch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoShow the stderr for failed GIT commands
Catalin Marinas [Sun, 11 Jun 2006 12:05:56 +0000 (13:05 +0100)]
Show the stderr for failed GIT commands

This allows easier diagnosis of the faults.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix the t1201-pull-trailing.sh test
Catalin Marinas [Sun, 11 Jun 2006 12:05:02 +0000 (13:05 +0100)]
Fix the t1201-pull-trailing.sh test

The test was expecting a failure but StGIT actually does a three-way merge
that succeeds.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoClassify commands in stg --help output.
Yann Dirson [Sun, 28 May 2006 21:25:19 +0000 (23:25 +0200)]
Classify commands in stg --help output.

Commands will be much easier to find out that way.
Inspiration mostly comes from pg-help.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoAdd the --replace option to import
Catalin Marinas [Tue, 6 Jun 2006 18:15:13 +0000 (19:15 +0100)]
Add the --replace option to import

By default, import fails if an existing patch is found with the same name.
With this option, import replaces the existing patch if it is unapplied.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow to specify multiple patch names on push command-line
Yann Dirson [Sun, 28 May 2006 07:46:11 +0000 (08:46 +0100)]
Allow to specify multiple patch names on push command-line

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoImplement the 'goto' command
Catalin Marinas [Thu, 25 May 2006 20:38:10 +0000 (21:38 +0100)]
Implement the 'goto' command

Push/pop patches to/from the stack until the one given on the command
line becomes current. This is a shortcut for the 'push --to' or 'pop
--to' commands. There is no '--undo' option for 'goto'. Use the 'push'
command for this.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd the --update option to pick
Catalin Marinas [Wed, 24 May 2006 21:03:40 +0000 (22:03 +0100)]
Add the --update option to pick

This option updates the current patch with changes from the picked commit
or patch. This option is useful when work is done on a temporary patch but
the changes need to be folded back into existing patches. Note that
three-way merging is not supported with this option (I'm not sure it is
even needed).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoExplicitly specify utf-8 coding in file
Karl Hasselström [Wed, 24 May 2006 06:07:21 +0000 (08:07 +0200)]
Explicitly specify utf-8 coding in file

uncommit.py has a non-ascii character in it (in my name in the
copyright line). Without this coding: comment, I get an error like the
following when I run stgit:

  /home/kha/git/stgit/stgit/main.py:61: DeprecationWarning: Non-ASCII
  character '\xc3' in file
  /home/kha/git/stgit/stgit/commands/uncommit.py on line 3, but no
  encoding declared; see http://www.python.org/peps/pep-0263.html for
  details

17 years agoFix indexing error during "diff -r/"
Karl Hasselström [Wed, 24 May 2006 06:06:58 +0000 (08:06 +0200)]
Fix indexing error during "diff -r/"

The string indexing when decoding the -r argument for diff made an
implicit assumption that the revision string was at least two
characters long, which broke on the simple invocation "diff -r/".

17 years agoFix infinite recursion on absolute paths
Karl Hasselström [Wed, 24 May 2006 06:06:43 +0000 (08:06 +0200)]
Fix infinite recursion on absolute paths

Calling create_dirs with an absolute path caused infinite recursion,
since os.path.dirname('/') == '/'. Fix this by exiting early if the
given path already is a directory.

17 years agoTests for branch names with slashes
Karl Hasselström [Thu, 18 May 2006 20:36:41 +0000 (21:36 +0100)]
Tests for branch names with slashes

Test a number of operations on a repository that has branch names
containing slashes (that is, branches living in a subdirectory of
.git/refs/heads).

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoHandle branch names with slashes
Karl Hasselström [Thu, 18 May 2006 20:36:41 +0000 (21:36 +0100)]
Handle branch names with slashes

Teach stgit to handle branch names with slashes in them; that is,
branches living in a subdirectory of .git/refs/heads.

I had to change the patch@branch/top command-line syntax to
patch@branch//top, in order to get sane parsing. The /top variant is
still available for repositories that have no slashy branches; it is
disabled as soon as there exists at least one subdirectory of
refs/heads. Preferably, this compatibility hack can be killed some
time in the future.

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoDon't die when there are no branches
Karl Hasselström [Thu, 18 May 2006 20:36:40 +0000 (21:36 +0100)]
Don't die when there are no branches

Signed-off-by: Karl Hasselström <kha@treskal.com>
17 years agoAllow configurable file extensions for merge conflicts
Catalin Marinas [Tue, 9 May 2006 20:21:28 +0000 (21:21 +0100)]
Allow configurable file extensions for merge conflicts

The files left after a merge conflict had confusing extensions. This patch
adds the "extensions" config option and also sets the defaults to
".ancestor", ".current" and ".patched".

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAdd a simple makefile
Pavel Roskin [Mon, 8 May 2006 20:22:06 +0000 (21:22 +0100)]
Add a simple makefile

Signed-off-by: Pavel Roskin <proski@gnu.org>
17 years agoAdd .gitignore files, list generated files there
Pavel Roskin [Mon, 8 May 2006 20:22:06 +0000 (21:22 +0100)]
Add .gitignore files, list generated files there

Signed-off-by: Pavel Roskin <proski@gnu.org>
17 years agoFix git.reset() to remove the added files
Catalin Marinas [Mon, 8 May 2006 20:21:22 +0000 (21:21 +0100)]
Fix git.reset() to remove the added files

The combination of git-read-tree and git-checkout-index used in the
git.checkout() function doesn't remove the files added to the index. This
patch adds the file removal support to the git.reset() function. It also
changes the git.apply_diff() call in stack.Series.merged_patches() so that
the the index is always updated (otherwise the reset wouldn't know which
files to remove).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFix the added to both but different conflict
Catalin Marinas [Wed, 3 May 2006 19:34:18 +0000 (20:34 +0100)]
Fix the added to both but different conflict

By default, the index was left with two unmerged entries. StGIT tries to
leave the index clean after conflicts.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoAllow git.checkout() to work on unmerged indexes
Catalin Marinas [Wed, 3 May 2006 19:34:18 +0000 (20:34 +0100)]
Allow git.checkout() to work on unmerged indexes

If the index has unmerged entries, the current checkout implementation
fails because of the -m option. This patch removes the option since it is
not needed on tree_id is specified. This also allows "stg status --reset"
to work on unmerged indexes.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
17 years agoFixes to the pull testcases.
Yann Dirson [Wed, 3 May 2006 19:34:18 +0000 (20:34 +0100)]
Fixes to the pull testcases.

As mentionned earlier, the original testcases do not take --merged
into account.  Let's expect the push to fail without it, and succeed
with it.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoLook for templates in ~/.stgit/templates as well
Yann Dirson [Sun, 16 Apr 2006 10:52:46 +0000 (12:52 +0200)]
Look for templates in ~/.stgit/templates as well

This can be quite useful to avoid adding one's sig again and again to
ever covermail, and to use a patchmail template that insert
Signed-off-by lines, for those of us who prefer this to adding them to
commits.

Also make sure to use os.path.join() instead of hardcoded slashes.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoExercise "stg pull" on patches just appending lines.
Yann Dirson [Sun, 16 Apr 2006 10:52:44 +0000 (12:52 +0200)]
Exercise "stg pull" on patches just appending lines.

It indeed reveals a problem in "push": appended lines are appended
again, as the already-applied patch is not detected.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoTest that pulls a patch creating a file that got modified afterwards
Yann Dirson [Sun, 16 Apr 2006 20:40:29 +0000 (22:40 +0200)]
Test that pulls a patch creating a file that got modified afterwards

This demonstrates an issue wite has bitten me more than once: the stg
branch adds a file in one patch, and modifies it in a later patch; then all
patches get integrated in upstream tree, and at "stg pull" time, stgit
believes there is a conflict, even when the patches are exactly the same.

This is normal as it requires the --merged flag on push or pull.  So
we rollback with "push --undo" and "push --merge" to finish.

17 years agoFix a seriously bad interaction between .git caching and repo cloning
Yann Dirson [Sun, 16 Apr 2006 10:52:39 +0000 (12:52 +0200)]
Fix a seriously bad interaction between .git caching and repo cloning

Testcase 2 exhibits a problem with caching the location of .git while
cloning a repository.  Since basedir.get() is called before the clone is
built, a value may get stored in the cache if we are within a
git-controlled tree already.  Then when constructing the object for the
clone, a bogus .git is used, which can lead, when running tests in t/trash,
to corruption of the stgit .git repository.

Testcase 1 does not show any problem by chance, because since we have a
./.git prepared for use by the testsuite, value ".git" get cached, and it
happens that this value will be still valid after chdir'ing into the
newborn clone.

Clearing the cache at the appropriate place fixes the problem.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoCorrectly handle refs/patches on series rename
Yann Dirson [Sun, 16 Apr 2006 10:52:37 +0000 (12:52 +0200)]
Correctly handle refs/patches on series rename

When renaming a series, the refs/patches dir was not moved, and by
chance a new one was created by the repository-upgrade code, but that
left the old one behind as cruft (which the safety checks added in a
former patch now detects).

Also adds a regression test to assert that nothing by the old name
is left behind.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoMake branch creation atomic
Yann Dirson [Sun, 16 Apr 2006 10:52:35 +0000 (12:52 +0200)]
Make branch creation atomic

This patch adds an optional create_at parameter to Series.init(), to
pass a git.branch_create() parameter if we want it to be called.  This
parameter can be None, so the test for False has to be explicit.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoAdd a couple of safety checks to series creation
Yann Dirson [Sun, 16 Apr 2006 10:52:32 +0000 (12:52 +0200)]
Add a couple of safety checks to series creation

- we must check first whether the operation can complete, instead of
  bombing out halfway.  That means checking that nothing will prevent
  the creation of stgit data (note that calling is_initialised() is
  not enough, as it does not catch a bogus file), which is tested by
  the 3 first couple of testcases, and fixed in stack.py

- creating the git branch unconditionally before knowing whether
  creation of the stgit stuff can be completed is a problem as well:
  being atomic would be much much better.  To emulate atomicity (which
  comeds in the next patch), this patch does a somewhat dirty hack to
  branch.py: we first attempt to create the stgit stuff, and if that
  succeeds, we create the git branch: it is much easier to do at first
  a quick check that the latter will succeed.  Testcase 7/8 ensure
  that such a safety check has not been forgotten.

- when git already reports a problem with that head we would like to
  create, we should catch it.  Testcase 9/10 creates such a situation,
  and the fix to git.py allows to catch the error spit out by
  git-rev-parse.  I cannot tell why the stderr lines were not included
  by the Popen3 object.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoAdd list of bugs to TODO
Yann Dirson [Sun, 16 Apr 2006 10:52:30 +0000 (12:52 +0200)]
Add list of bugs to TODO

Since there is no formal place to register bugs, other than the git
ml, I have added a couple of them, some of them already mentionned on
the ml but still around.

Signed-off-by: Yann Dirson <ydirson@altern.org>
17 years agoAdd a testsuite framework copied from git-core
Yann Dirson [Sun, 16 Apr 2006 10:52:28 +0000 (12:52 +0200)]
Add a testsuite framework copied from git-core

See git's t/README for details on how to use this framework.

There is no integration yet in the toplevel Makefile, I'll let
python masters take care of this.  Use "make -C t" to run the
tests for now.

A patch-naming policy should be defined for stgit, since the
git one does not apply.

Signed-off-by: Yann Dirson <ydirson@altern.org>
18 years agoRelease 0.9 v0.9
Catalin Marinas [Fri, 7 Apr 2006 20:46:30 +0000 (21:46 +0100)]
Release 0.9

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoUse 'git-*' instead of 'git *'
Catalin Marinas [Thu, 6 Apr 2006 20:22:05 +0000 (21:22 +0100)]
Use 'git-*' instead of 'git *'

This is to avoid starting the shell twice, at least until the GIT people
decide to no longer support the 'git-*' commands.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoUse a pager for diff and show commands
Catalin Marinas [Fri, 31 Mar 2006 17:42:35 +0000 (18:42 +0100)]
Use a pager for diff and show commands

This patch also adds a pager configuration option that overrides the
default PAGER environment variable.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoRemove the basedir exception throwing
Catalin Marinas [Fri, 31 Mar 2006 17:42:34 +0000 (18:42 +0100)]
Remove the basedir exception throwing

This is preventing even 'clone' from working properly.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoAdd a 'show' command
Catalin Marinas [Fri, 31 Mar 2006 17:42:34 +0000 (18:42 +0100)]
Add a 'show' command

This command is similar to 'git show' only that it understands patch names
as well as normal commit ids.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoAdd the '--undo' option to 'refresh'
Catalin Marinas [Fri, 31 Mar 2006 17:42:34 +0000 (18:42 +0100)]
Add the '--undo' option to 'refresh'

This option is useful when adding the changes to the wrong patch (usually
instead of creating a new one).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoPass --directory to git-ls-files for stg status
Paolo 'Blaisorblade' Giarrusso [Wed, 29 Mar 2006 14:25:31 +0000 (16:25 +0200)]
Pass --directory to git-ls-files for stg status

Requires GIT 1.1.0 at least (don't know if this was backported in 1.0).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
18 years agoAdd extra headers to the e-mail messages
Catalin Marinas [Tue, 28 Mar 2006 21:01:03 +0000 (22:01 +0100)]
Add extra headers to the e-mail messages

This patch adds the Content-Type, Content-Transfer-Encoding and User-Agent
headers to the e-mail messages.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoRemove the checking for the default configuration values
Catalin Marinas [Tue, 28 Mar 2006 21:01:02 +0000 (22:01 +0100)]
Remove the checking for the default configuration values

Since some options are set as defaults in stgit/config.py, there is no need
to check for their presence with config.has_option().

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoCreate stgit/basedir.py for determining the .git directory
Catalin Marinas [Tue, 28 Mar 2006 21:01:02 +0000 (22:01 +0100)]
Create stgit/basedir.py for determining the .git directory

basedir.get() function is used in many files and leaving it only in
stgit.git caused some cyclic imports.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoAdd the "smtpdelay" config option
Catalin Marinas [Tue, 28 Mar 2006 21:01:02 +0000 (22:01 +0100)]
Add the "smtpdelay" config option

This option is similar to the --sleep option for the mail command, i.e. the
number of seconds between sending two consecutive patches.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoThe gitmergeonefile config section is deprecated
Catalin Marinas [Tue, 28 Mar 2006 21:01:02 +0000 (22:01 +0100)]
The gitmergeonefile config section is deprecated

Use [stgit] instead. For backward compatibility, also check the
[gitmergeonefile] section.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>