stgit
16 years agoRemove "stg rm"
Karl Hasselström [Wed, 19 Dec 2007 18:00:13 +0000 (18:00 +0000)]
Remove "stg rm"

git-rm can do the same job just as well. Besides, since StGit notices
when a file disappears, just "rm" can also do the job.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRemove "stg add"
Karl Hasselström [Wed, 19 Dec 2007 18:00:13 +0000 (18:00 +0000)]
Remove "stg add"

git-add does the exact same job, so there's no need to have it in
StGit.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoWe keep the different stages of a conflict in the index now
Karl Hasselström [Wed, 19 Dec 2007 18:00:13 +0000 (18:00 +0000)]
We keep the different stages of a conflict in the index now

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRefactoring: pass more than one file to resolved()
Karl Hasselström [Wed, 19 Dec 2007 18:00:13 +0000 (18:00 +0000)]
Refactoring: pass more than one file to resolved()

This lets us cut down on the number of calls to git.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoFix "stg resolved" to work with new conflict representation
Karl Hasselström [Wed, 19 Dec 2007 18:00:13 +0000 (18:00 +0000)]
Fix "stg resolved" to work with new conflict representation

The actual resolving is done by calling the same subroutine as "git
add".

Instead of using existing *.{ancestor,current,patches} files, the
interactive merge has to create them from the index contents, and
delete them afterwards.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoBetter error message if merge fails
Karl Hasselström [Wed, 19 Dec 2007 18:00:12 +0000 (18:00 +0000)]
Better error message if merge fails

This message is no longer printed in case of conflicts, just in case
the merge really failed; so don't talk about conflicts in the error
message.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoAsk git about unmerged files
David Kågedal [Wed, 19 Dec 2007 18:00:12 +0000 (18:00 +0000)]
Ask git about unmerged files

Don't look in the "conflicts" file for that, since it isn't updated. Also
added a test that the check_conflicts() function works.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoNicer conflict markers
Karl Hasselström [Wed, 19 Dec 2007 18:00:12 +0000 (18:00 +0000)]
Nicer conflict markers

Instead of tagging the conflict markers with sha1 hashes, use
"ancestor", "current", and "patched".

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoUse the output from merge-recursive to list conflicts
David Kågedal [Wed, 19 Dec 2007 18:00:12 +0000 (18:00 +0000)]
Use the output from merge-recursive to list conflicts

merge-recursive already has useful information about what the conflicts
were, so we reuse that when pushing.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoSimplify merge_recursive
David Kågedal [Wed, 19 Dec 2007 18:00:12 +0000 (18:00 +0000)]
Simplify merge_recursive

Listing the unmerged files is unnecessary, since the information
isn't really used anyway. Just note if the merge failed or succeeded.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoAdded a test case to check what happens when push finds a conflict
David Kågedal [Wed, 19 Dec 2007 18:00:11 +0000 (18:00 +0000)]
Added a test case to check what happens when push finds a conflict

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoLeave working dir and index alone after failed (conflicting) push
David Kågedal [Wed, 19 Dec 2007 18:00:11 +0000 (18:00 +0000)]
Leave working dir and index alone after failed (conflicting) push

This leaves the index and working tree in the state that merge-recursive
left it, with unmerged files in different stages, and the non-conflicting
changes in the index.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoSplit git.merge into two functions
David Kågedal [Wed, 19 Dec 2007 18:00:11 +0000 (18:00 +0000)]
Split git.merge into two functions

This only prepares for later simplifications.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoWrite removed fields for backwards compatibility
Karl Hasselström [Wed, 19 Dec 2007 18:00:11 +0000 (18:00 +0000)]
Write removed fields for backwards compatibility

Start writing the "top", "bottom", and "bottom.old" fields again. The
last two patches mean we don't need them anymore, but old versions of
StGit still do.

At some later time, we'll want to change the stack on-disk format so
that these can be removed. But we'll probably want to do that as part
of a larger change.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRemove the 'top' field
David Kågedal [Wed, 19 Dec 2007 18:00:11 +0000 (18:00 +0000)]
Remove the 'top' field

The top is instead implicitly defined by the patch ref.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRemove the 'bottom' field
David Kågedal [Wed, 19 Dec 2007 18:00:10 +0000 (18:00 +0000)]
Remove the 'bottom' field

The bottom is instead always calculated from the top by getting its
parent commit.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoCheck bottom and invariants
David Kågedal [Wed, 19 Dec 2007 18:00:10 +0000 (18:00 +0000)]
Check bottom and invariants

This code adds some checks that the bottom is actually always the
parent of top.

It also checks that the top is the same as what the patch ref points
to.

This is only to ensure that the next patches are correct.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: Added stgit-new
David Kågedal [Wed, 19 Dec 2007 18:00:09 +0000 (18:00 +0000)]
Emacs mode: Added stgit-new

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: added fontification
David Kågedal [Wed, 19 Dec 2007 18:00:09 +0000 (18:00 +0000)]
Emacs mode: added fontification

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: Add stgit-edit command
David Kågedal [Wed, 19 Dec 2007 18:00:09 +0000 (18:00 +0000)]
Emacs mode: Add stgit-edit command

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: added stgit-commit and stgit-uncommit
David Kågedal [Wed, 19 Dec 2007 18:00:09 +0000 (18:00 +0000)]
Emacs mode: added stgit-commit and stgit-uncommit

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: add stgit-repair
David Kågedal [Wed, 19 Dec 2007 18:00:09 +0000 (18:00 +0000)]
Emacs mode: add stgit-repair

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: Bind n and p
David Kågedal [Wed, 19 Dec 2007 18:00:09 +0000 (18:00 +0000)]
Emacs mode: Bind n and p

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: Improve the output buffer state
David Kågedal [Wed, 19 Dec 2007 18:00:08 +0000 (18:00 +0000)]
Emacs mode: Improve the output buffer state

Make the output buffer have the correct default-directory, and make it
read-only and unmodified.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: show patches' short description
Karl Hasselström [Wed, 19 Dec 2007 18:00:08 +0000 (18:00 +0000)]
Emacs mode: show patches' short description

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
16 years agoEmacs mode: Bind "G" to "stg goto"
Karl Hasselström [Wed, 19 Dec 2007 18:00:08 +0000 (18:00 +0000)]
Emacs mode: Bind "G" to "stg goto"

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
16 years agoEmacs mode: Let "P" push or pop patch at point
Karl Hasselström [Wed, 19 Dec 2007 18:00:08 +0000 (18:00 +0000)]
Emacs mode: Let "P" push or pop patch at point

When the user presses "P", push or pop the patch at point depending on
whether it's applied or unapplied.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
16 years agoEmacs mode: push/pop next patch, not patch at point
Karl Hasselström [Wed, 19 Dec 2007 18:00:08 +0000 (18:00 +0000)]
Emacs mode: push/pop next patch, not patch at point

The three operations we should have are:

  * Pop the topmost applied patch, no matter where point is.

  * Push the first unapplied patch, no matter where point is.

  * Push/pop the patch at point, depending on whether it's currently
    applied.

This patch makes "<" and ">" do the first two operations. The third is
coming in a later patch.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
16 years agoEmacs mode: Makefile for building stgit.el
Karl Hasselström [Wed, 19 Dec 2007 18:00:07 +0000 (18:00 +0000)]
Emacs mode: Makefile for building stgit.el

Shamelessly stolen from git's contrib/emacs/Makefile.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
16 years agoEmacs mode: Add an explanatory header
Karl Hasselström [Wed, 19 Dec 2007 18:00:07 +0000 (18:00 +0000)]
Emacs mode: Add an explanatory header

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
16 years agoEmacs mode: Show keybindings when user presses "h" or "?"
Karl Hasselström [Wed, 19 Dec 2007 18:00:07 +0000 (18:00 +0000)]
Emacs mode: Show keybindings when user presses "h" or "?"

These are the same keys the git emacs mode uses.

Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
16 years agoAdd an StGit mode for emacs
David Kågedal [Wed, 19 Dec 2007 18:00:07 +0000 (18:00 +0000)]
Add an StGit mode for emacs

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoName the exit codes to improve legibility
Karl Hasselström [Wed, 12 Dec 2007 22:44:12 +0000 (23:44 +0100)]
Name the exit codes to improve legibility

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMake generic --message/--file/--save-template flags
Karl Hasselström [Wed, 12 Dec 2007 23:13:55 +0000 (00:13 +0100)]
Make generic --message/--file/--save-template flags

And let "stg edit" use them.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoLet parse_patch take a string instead of a file parameter
Karl Hasselström [Wed, 12 Dec 2007 21:33:32 +0000 (22:33 +0100)]
Let parse_patch take a string instead of a file parameter

This makes it more generally useful, since all future callers may not
have the input in a file.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoTreat filename '-' as stdin/stdout in edit
David Kågedal [Mon, 10 Dec 2007 21:43:55 +0000 (22:43 +0100)]
Treat filename '-' as stdin/stdout in edit

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoAdded --save-template flag to edit command
David Kågedal [Tue, 11 Dec 2007 11:00:16 +0000 (12:00 +0100)]
Added --save-template flag to edit command

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRelease 0.14.1 v0.14.1
Catalin Marinas [Tue, 11 Dec 2007 23:51:54 +0000 (23:51 +0000)]
Release 0.14.1

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoFix typo: we require Python 2.4, not 2.5
Karl Hasselström [Tue, 11 Dec 2007 14:23:47 +0000 (15:23 +0100)]
Fix typo: we require Python 2.4, not 2.5

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRelease 0.14 v0.14
Catalin Marinas [Sun, 9 Dec 2007 23:45:08 +0000 (23:45 +0000)]
Release 0.14

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoBetter handling of binary files (bug #8495)
Catalin Marinas [Sun, 9 Dec 2007 23:32:58 +0000 (23:32 +0000)]
Better handling of binary files (bug #8495)

The patch adds the '--binary' option to the git-diff-tree and git-diff-index
commands. The git-apply no longer needs this flag as it is set by default.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow only certain gitk exit codes as valid
Catalin Marinas [Sat, 8 Dec 2007 23:16:30 +0000 (23:16 +0000)]
Allow only certain gitk exit codes as valid

This patch fixes the log and series commands to not report an error when
gitk is killed by the user.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoDon't use test_expect_failure for tests that are supposed to work
Karl Hasselström [Sat, 8 Dec 2007 11:00:10 +0000 (12:00 +0100)]
Don't use test_expect_failure for tests that are supposed to work

test_expect_failure is only for marking known bugs.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoDiscard exitcode of subprocess in a better way
Karl Hasselström [Sat, 8 Dec 2007 08:27:22 +0000 (09:27 +0100)]
Discard exitcode of subprocess in a better way

Discard the exit code in a way that meshes better with the existing
handling of exit codes.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoFix bashism
Karl Hasselström [Sat, 8 Dec 2007 09:30:40 +0000 (10:30 +0100)]
Fix bashism

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMake sure the refid given to 'mail' has the angle brackets
Catalin Marinas [Fri, 7 Dec 2007 21:19:25 +0000 (21:19 +0000)]
Make sure the refid given to 'mail' has the angle brackets

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoSome clean-up of the branch manipulation commands
Catalin Marinas [Fri, 7 Dec 2007 21:19:25 +0000 (21:19 +0000)]
Some clean-up of the branch manipulation commands

A GIT branch couldn't be deleted if it wasn't a StGIT stack. Added
tests for the creation of branches when the current branch isn't a
stack.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoIgnore the gitk exit code in 'stg log -g' (bug #10010)
Catalin Marinas [Fri, 7 Dec 2007 21:19:25 +0000 (21:19 +0000)]
Ignore the gitk exit code in 'stg log -g' (bug #10010)

The patch adds the 'exitcode' boolean argument to Run.run() and
modifies the 'log' command.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAdd the 'log --number' option to limit the output
Catalin Marinas [Fri, 7 Dec 2007 21:19:25 +0000 (21:19 +0000)]
Add the 'log --number' option to limit the output

The patch also changes the construction of the string when --patch is
supplied to avoid resource consumption (using a list and joining at
the end rather than creating a bigger and bigger string).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoChange the file timestamp in 'resolved --reset' (bug #10017)
Catalin Marinas [Fri, 7 Dec 2007 21:19:24 +0000 (21:19 +0000)]
Change the file timestamp in 'resolved --reset' (bug #10017)

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow 'show' and 'id' to work on non-StGIT branches (bug #10011)
Catalin Marinas [Fri, 7 Dec 2007 21:19:24 +0000 (21:19 +0000)]
Allow 'show' and 'id' to work on non-StGIT branches (bug #10011)

Some clean-up to only access the current series object if needed.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agogit.pretty_commit() re-implemented with "git show" (bug #10018)
Catalin Marinas [Fri, 7 Dec 2007 21:16:36 +0000 (21:16 +0000)]
git.pretty_commit() re-implemented with "git show" (bug #10018)

This way, it honours the diff.renames etc. options.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoCheck the minimum required versions of GIT and Python (bug #10218)
Catalin Marinas [Fri, 7 Dec 2007 21:16:36 +0000 (21:16 +0000)]
Check the minimum required versions of GIT and Python (bug #10218)

The patch modifies the setup.py script to check the minimum versions
of GIT and Python required for building and installing StGIT. They are
currently set to git-1.5.2 and Python-2.4.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAdd a test for the 'mail --attach' command
Catalin Marinas [Fri, 7 Dec 2007 21:16:36 +0000 (21:16 +0000)]
Add a test for the 'mail --attach' command

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow multipart templates for patch e-mails (bug #10237)
Catalin Marinas [Thu, 6 Dec 2007 23:28:42 +0000 (23:28 +0000)]
Allow multipart templates for patch e-mails (bug #10237)

If the template is a multipart MIME message, it sets the charset only to
the payloads. The patch also adds the '--attach' option to 'mail' which uses
the templates/mailattch.tmpl template file.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoClean-up if the branch creation fails (bug #10015)
Catalin Marinas [Tue, 4 Dec 2007 21:46:14 +0000 (21:46 +0000)]
Clean-up if the branch creation fails (bug #10015)

If the tree switching fails during the branch creation, the new head
will be reverted and the new branch deleted.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoCorrectly identify the parent branch (bug #10014)
Catalin Marinas [Mon, 3 Dec 2007 10:30:20 +0000 (10:30 +0000)]
Correctly identify the parent branch (bug #10014)

Any valid git ref was identified as a possible parent branch. This patch
adds a check for the refs listed by git-show-ref.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoCheck for disappeared newborn files in git.tree_status (bug #8516)
Catalin Marinas [Sat, 1 Dec 2007 23:00:00 +0000 (23:00 +0000)]
Check for disappeared newborn files in git.tree_status (bug #8516)

If a file is added to the index (stg add) but is removed from the shell,
git.tree_status doesn't detect it but other commands like push fail. The
patch adds a call to 'git diff-files' in git.tree_status.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoMake Series.refresh_patch automatically save the undo information
Catalin Marinas [Sat, 1 Dec 2007 22:59:59 +0000 (22:59 +0000)]
Make Series.refresh_patch automatically save the undo information

The patch pushing with was losing the undo information because the arguments
passed to refresh_patch. The backup argument now defaults to True since
this is needed in most of the cases.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoMake "stg repair" help text more helpful
Karl Hasselström [Fri, 30 Nov 2007 01:20:03 +0000 (02:20 +0100)]
Make "stg repair" help text more helpful

Specifically, point out that if messing up the branch with git
commands was a mistake, the user should run "git reset", not "stg
repair".

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoImprove the t1205 test for push
Catalin Marinas [Tue, 27 Nov 2007 22:30:21 +0000 (22:30 +0000)]
Improve the t1205 test for push

Bug #9311 reported in the past for a push conflict with an unrecorded
file. It is no longer reproducible but test added for future
regression.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoKeep the patch log when import --replace deletes patches
Catalin Marinas [Tue, 27 Nov 2007 10:32:12 +0000 (10:32 +0000)]
Keep the patch log when import --replace deletes patches

This is a fix for bug #10123.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAdd missing switch to "stg uncommit" usage line
Karl Hasselström [Sun, 25 Nov 2007 11:42:35 +0000 (12:42 +0100)]
Add missing switch to "stg uncommit" usage line

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoPush and pop don't have --to flags anymore
Karl Hasselström [Sun, 25 Nov 2007 08:52:04 +0000 (09:52 +0100)]
Push and pop don't have --to flags anymore

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agostg-gitk: allow passing args to gitk; add --help.
Yann Dirson [Thu, 22 Nov 2007 21:23:34 +0000 (22:23 +0100)]
stg-gitk: allow passing args to gitk; add --help.

Quite handy to further limit the commits to be shown.

16 years agoAdded test case for stg refresh
David Kågedal [Wed, 21 Nov 2007 10:35:59 +0000 (11:35 +0100)]
Added test case for stg refresh

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoExecute the 'git ...' rather than 'git-...'
Catalin Marinas [Wed, 14 Nov 2007 21:14:55 +0000 (21:14 +0000)]
Execute the 'git ...' rather than 'git-...'

Since many commands are now built into the git binary, it doesn't make
sense to run the git-... scripts. The patch modifies the GRun class to
pass the 'git' file name together with the command arguments. It also
modifies all the other calls to git-...

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years ago'stg pop --keep' doesn't update the index
Catalin Marinas [Wed, 14 Nov 2007 21:14:55 +0000 (21:14 +0000)]
'stg pop --keep' doesn't update the index

While git.apply_diff works correctly, the git.switch implementation
doesn't update the index (only the HEAD) and a subsequent 'stg refresh'
would merge all the popped patches into the current one ('stg refresh
--patch' fails in the same way). This patch fixes git.switch to read the
new index (git-read-tree) if keep == True.

Before commit a77bfa77 (to fix bug #8972), git-apply had the --index
option to automatically update the index but it was failing in many
cases.

The drawback is that a subsequent git-update-index takes longer than
usual, but at least we have a correct behaviour.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow the diff showing in the log command if patch modified by edit
Catalin Marinas [Mon, 12 Nov 2007 10:57:09 +0000 (10:57 +0000)]
Allow the diff showing in the log command if patch modified by edit

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agostg repair: Patchify non-patch commits between patches
Karl Hasselström [Sun, 11 Nov 2007 12:39:12 +0000 (13:39 +0100)]
stg repair: Patchify non-patch commits between patches

This teaches "stg repair" to find non-patch commits that sit between
patches, and turn them into patches. This situation can happen e.g.
like this:

  stg new -m A && stg new -m B && stg new -m C
  stg pop A B C
  stg push B
  echo foo > foo && git add foo && stg refresh
  git reset --hard $(stg id C)

The old "stg repair" would at this point simply conclude that A and C
are applied, and B unapplied. However, B's old commit is still between
them even though it's not a patch, which will cause problems later --
StGit generally assumes that the applied patches are a consecutive
string of commits. The new "stg repair", on the other hand, will find
B's old commit, and create a new patch for it.

One downside of this change is that we can no longer conclude that all
is well just because head == top, so no-op runs of "stg repair" just
got more expensive.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRename "stg assimilate" to "stg repair"
Karl Hasselström [Sun, 11 Nov 2007 13:07:36 +0000 (14:07 +0100)]
Rename "stg assimilate" to "stg repair"

With the capabilities it's gained lately, this is a better name.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoLet some commands work with detached HEAD
Karl Hasselström [Mon, 8 Oct 2007 03:52:06 +0000 (05:52 +0200)]
Let some commands work with detached HEAD

add, resolved, and status didn't use the crt_series that was
initialized for them. So don't initialize it, since that means (1)
less work and (2) they won't fail when HEAD is detached.

Note that this doesn't completely fix the problem with detached HEAD:
a number of other commands (e.g. branch) don't always need to refer to
a current series, but currently fails on a detached HEAD even in those
situations.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoCogito is deprecated, so don't point to it
Karl Hasselström [Wed, 31 Oct 2007 23:27:54 +0000 (00:27 +0100)]
Cogito is deprecated, so don't point to it

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoSimple test for "stg clean"
Karl Hasselström [Thu, 8 Nov 2007 04:54:26 +0000 (05:54 +0100)]
Simple test for "stg clean"

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoFix more commands to run correctly in subdirectories
Catalin Marinas [Wed, 7 Nov 2007 22:12:24 +0000 (22:12 +0000)]
Fix more commands to run correctly in subdirectories

Raised recently with bug #10276, commands manipulating patches might
fail to run correctly (even losing data) in subdirectories, mainly
because of git-apply (see the bug log for explanation). This patch
forces all the patch-modifying commands to go to the top level
directory before acting.

In addition to the above, ot also fixes the resolved and export
commands.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow "branch --create" to be given a tag id
Catalin Marinas [Fri, 2 Nov 2007 21:25:58 +0000 (21:25 +0000)]
Allow "branch --create" to be given a tag id

In the past, this used to lead to a broken branch which could be
difficult to even delete. This patch allows the branch to be created
properly and be more tolerant to branch deletion.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow StGIT commands to run correctly in subdirectories
Catalin Marinas [Tue, 23 Oct 2007 21:20:53 +0000 (22:20 +0100)]
Allow StGIT commands to run correctly in subdirectories

This is mainly achieved by checking the file arguments with
git-ls-files. The patch solves two main issues - the refresh/diff/st
can run properly in subdirectories and commands like diff and status
may no longer get nonexistent files as arguments without complaining.

If one wants to check the status/diff or refresh the files in a
subdirectory, the command arguments should be "." and this is expanded
by git-ls-files to the subdirectory content (recursively).

The patch removes some asserts as they are no longer needed since
checks are performed by git-ls-files.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoDo not raise an exception if no FETCH_HEAD
Catalin Marinas [Wed, 17 Oct 2007 20:35:21 +0000 (21:35 +0100)]
Do not raise an exception if no FETCH_HEAD

The fetchcmd option in .git/config can be set to a command that
doesn't generate a FETCH_HEAD file (like 'git svn fetch'). With this
patch, StGIT will only warn if no FETCH_HEAD is found as it is quite
likely that the rebasecmd doesn't need one ('git svn rebase'). The
patch also modifies the 'fetch-rebase' case in pull.py so that it
re-raises the exception initially raised by git.fetch_head() as this
function has the correct information about the type of exception.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years ago"stg pop --keep" fails because of git-apply --index (bug #8972)
Catalin Marinas [Wed, 17 Oct 2007 20:35:21 +0000 (21:35 +0100)]
"stg pop --keep" fails because of git-apply --index (bug #8972)

This patch calls git-apply without --index if --keep is passed to the
pop or goto commands.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoFix assertion in patch creation
Catalin Marinas [Wed, 17 Oct 2007 20:35:01 +0000 (21:35 +0100)]
Fix assertion in patch creation

Top and bottom can be unrelated if the "commit" argument is true since
new_patch will generate a new commit object anyway. Fix the
corresponding assert.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoNew test: "stg diff"
Karl Hasselström [Tue, 9 Oct 2007 04:34:24 +0000 (06:34 +0200)]
New test: "stg diff"

A simple test to make sure that we can run "stg diff" without
arguments, just to list local changes.

Note that two subtests currently fail; these are due to plain "stg
diff" failing on a branch where "stg init" hasn't been run, which is
plainly a bug.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoFix error message generation
Karl Hasselström [Tue, 9 Oct 2007 04:20:34 +0000 (06:20 +0200)]
Fix error message generation

The right-hand-side operand of % is supposed to be a tuple with the
same number of arguments as there are formatting codes in the
left-hand-side operand, or just any value if there is just one
formatting code; however, here it was a variable with a tuple value,
which didn't work. So wrap it in a tuple of length one, and all is
well again.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoDon't have a global crt_series in stgit.commans.common
Karl Hasselström [Mon, 8 Oct 2007 08:36:49 +0000 (10:36 +0200)]
Don't have a global crt_series in stgit.commans.common

Global variables baaad. Instead, pass it as a parameter to the
functions that need it.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRefactor crt_series creation
Karl Hasselström [Mon, 8 Oct 2007 05:46:27 +0000 (07:46 +0200)]
Refactor crt_series creation

Instead of hard-coding in main.py which commands do and don't need a
current series, let them speak for themselves.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoProperly detect that HEAD is detached
Karl Hasselström [Mon, 8 Oct 2007 05:15:33 +0000 (07:15 +0200)]
Properly detect that HEAD is detached

We still error out on a lot of places we shouldn't, e.g. "stg branch"
when on a detached HEAD, but at least now we give a sane error
message.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoUse our nice message printout wrapping system
Karl Hasselström [Mon, 8 Oct 2007 05:26:14 +0000 (07:26 +0200)]
Use our nice message printout wrapping system

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoAllow caller to customize title of error/warning message
Karl Hasselström [Mon, 8 Oct 2007 05:25:06 +0000 (07:25 +0200)]
Allow caller to customize title of error/warning message

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMake "stg refresh" subdirectory safe
Karl Hasselström [Sun, 7 Oct 2007 22:14:11 +0000 (00:14 +0200)]
Make "stg refresh" subdirectory safe

Make "stg refresh" subdirectory safe by letting it internally cd up to
the top of the worktree. This is possibly not the best long-term fix;
one could argue that the refresh subroutine should instead be safe to
run from a subdirectory. However, refreshing from a subdirectory
currently only refreshes changes that are in the index, and not
changes in the working directory, and that has to be fixed.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoNew test: try "stg refresh" in a subdirectory
Karl Hasselström [Sun, 7 Oct 2007 22:14:11 +0000 (00:14 +0200)]
New test: try "stg refresh" in a subdirectory

Currently, it doesn't work. Or rather, it does work for changes that
are already in the index, which is the case for newly added files; but
it doesn't work for changes that aren't in the index.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMake "stg push" subdirectory safe
Karl Hasselström [Sun, 7 Oct 2007 18:56:05 +0000 (20:56 +0200)]
Make "stg push" subdirectory safe

Make "stg push" subdirectory safe by letting it internally cd up to
the top of the worktree. This is possibly not the best long-term fix;
one could argue that the push subroutine should instead be safe to run
from a subdirectory. However, pushing from a subdirectory currently
erases the parts of a patch that doesn't touch that subdirectory, and
that has to be fixed.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoNew test: Try "stg push" in a subdirectory
Karl Hasselström [Sun, 7 Oct 2007 17:36:59 +0000 (19:36 +0200)]
New test: Try "stg push" in a subdirectory

This currently fails for the non-fast-forward cases.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoInfrastructure for current directory handling
Karl Hasselström [Sun, 7 Oct 2007 12:52:26 +0000 (14:52 +0200)]
Infrastructure for current directory handling

Add infrastructure to allow commands to specify if they need a git
repository, if they need to be called from within the working tree,
and if they should cd to the root of the working tree before doing
anything else.

For now, all commands are set to just require a repository (except
"stg clone", which is set to require nothing), which means the only
thing that's added is some very light error checking. The idea is to
tighten this for commands that turn out to need it.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRemove the --force flag to "stg rebase" and "stg pull"
Karl Hasselström [Tue, 11 Sep 2007 00:09:23 +0000 (02:09 +0200)]
Remove the --force flag to "stg rebase" and "stg pull"

Instead, always behave as if the force flag was given; that is, don't
check if rebasing would leave a dangling commit behind. Reasons:

  * The check for this was very strict and caused a lot of false
    positives.

  * Everything is recorded in the reflog, so we can't actually lose
    commits.

This fixes bug 9181.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoDiscard stderr output from git-rev-parse
Karl Hasselström [Sun, 7 Oct 2007 13:48:33 +0000 (15:48 +0200)]
Discard stderr output from git-rev-parse

This gets rid of the annoying "fatal: Needed a single revision"
messages that were printed in addition to StGit's own error message.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoSimplify debug level error checking
Karl Hasselström [Sun, 7 Oct 2007 13:09:11 +0000 (15:09 +0200)]
Simplify debug level error checking

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMake a common superclass for all StGit exceptions
Karl Hasselström [Sun, 7 Oct 2007 13:07:11 +0000 (15:07 +0200)]
Make a common superclass for all StGit exceptions

This makes it easier to catch them all. (Indeed, the very long list of
exceptions to catch in main.py was missing some of the exceptions.)

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoDon't split long and short description in "stg edit"
Karl Hasselström [Sun, 7 Oct 2007 11:34:18 +0000 (13:34 +0200)]
Don't split long and short description in "stg edit"

"stg edit" used to present the patch information like this:

  Short description

  From: ...
  Date: ...

  Long description

If the project follows the git convention with a single-line short
description and follwed by a blank line and the rest of the
description, this merely looks a little odd. However, for projects
that don't follow that convention, presenting the first line
separately is actively inconvenient; for example, it breaks emacs's
fill-paragraph command.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoFix up the help text for "stg edit"
Karl Hasselström [Sat, 6 Oct 2007 08:35:44 +0000 (10:35 +0200)]
Fix up the help text for "stg edit"

The sentence structure was strange, and the example format was
somewhat misleading (StGit doesn't care about sign-off lines, for
example).

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoNew test: "stg pop --keep"
Karl Hasselström [Sat, 6 Oct 2007 08:17:30 +0000 (10:17 +0200)]
New test: "stg pop --keep"

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoAdd --ack/--sign options to "stg new"
Karl Hasselström [Sat, 6 Oct 2007 07:47:29 +0000 (09:47 +0200)]
Add --ack/--sign options to "stg new"

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