chiark / gitweb /
stgit
16 years agoAdd stack creation and initialisation support to lib.Stack
Catalin Marinas [Sun, 8 Jun 2008 22:20:15 +0000 (23:20 +0100)]
Add stack creation and initialisation support to lib.Stack

This patch adds the create and initialise Stack classmethods to handle
the initialisation of StGIT patch series on a Git branch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
Acked-by: Karl Hasselström <kha@treskal.com>
16 years agoCreate a git.Branch class as ancestor of stack.Stack
Catalin Marinas [Sun, 8 Jun 2008 22:20:15 +0000 (23:20 +0100)]
Create a git.Branch class as ancestor of stack.Stack

This class deals with Git-specific branch commands. The Stack class is a
direct child of Branch and some of its functionality was moved to the new
class.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
Acked-by: Karl Hasselström <kha@treskal.com>
16 years agoRename Repository.head to Repository.head_ref
Catalin Marinas [Fri, 6 Jun 2008 20:35:14 +0000 (21:35 +0100)]
Rename Repository.head to Repository.head_ref

This is to avoid confusion with the Stack.head function which returns
a commit object rather than a file name. The patch also changes the
"new" function to use stack.head directly rather than via the
Repository.refs... object.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
Acked-by: Karl Hasselström <kha@treskal.com>
16 years agoAllow stack.patchorder.all to return hidden patches
Catalin Marinas [Fri, 6 Jun 2008 20:33:42 +0000 (21:33 +0100)]
Allow stack.patchorder.all to return hidden patches

A new property, patchorder.all_visible, was added to return only the
applied + unapplied patches. This is used in the "commit" command to
avoid automatically committing the hidden patches.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
Acked-by: Karl Hasselström <kha@treskal.com>
16 years agoFix the parse_patches() function to work with tuples
Catalin Marinas [Thu, 5 Jun 2008 21:20:14 +0000 (22:20 +0100)]
Fix the parse_patches() function to work with tuples

The series command passes a tuple to parse_patches instead of a patch list
(the new infrastructure) but there is no patch_list.index() function.
The patch transforms the tuple into a list.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoMerge commit 'kha/safe'
Catalin Marinas [Tue, 3 Jun 2008 21:22:56 +0000 (22:22 +0100)]
Merge commit 'kha/safe'

16 years agoMerge branch 'stable'
Catalin Marinas [Tue, 3 Jun 2008 21:22:45 +0000 (22:22 +0100)]
Merge branch 'stable'

16 years agoSome API documentation for the new infrastructure
Karl Hasselström [Tue, 3 Jun 2008 03:03:16 +0000 (05:03 +0200)]
Some API documentation for the new infrastructure

Not all that comprehensive, but better than nothing.

Uses epydoc (http://epydoc.sourceforge.net/) markup.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoWrap the text of error messages
Karl Hasselström [Tue, 3 Jun 2008 00:44:18 +0000 (02:44 +0200)]
Wrap the text of error messages

... so that they fit nicely in an 80-column terminal. This makes it
unnecessary to embed newlines and extra spaces in a few places.

This patch only wraps the text of tagged output messages. I haven't
found a reason to wrap other messages, but I haven't looked long and
hard.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMerge branch 'stable' into stable-master-merge
Karl Hasselström [Tue, 3 Jun 2008 00:43:24 +0000 (02:43 +0200)]
Merge branch 'stable' into stable-master-merge

16 years agoHandle refresh of changed files with non-ASCII names
Karl Hasselström [Tue, 3 Jun 2008 00:27:48 +0000 (02:27 +0200)]
Handle refresh of changed files with non-ASCII names

Without -z, git diff-files was quoting them for us.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoTest for another filename quoting issue in tree_status()
Karl Hasselström [Tue, 3 Jun 2008 00:26:10 +0000 (02:26 +0200)]
Test for another filename quoting issue in tree_status()

stgit.git.tree_status() had another filename quoting issue, similar to
the one just fixed. Test for that one too.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoHandle changed files with non-ASCII names
Karl Hasselström [Mon, 2 Jun 2008 23:45:08 +0000 (01:45 +0200)]
Handle changed files with non-ASCII names

Git was quoting them for us, which was not what we wanted. So call
diff-index with the -z flag, so that it doesn't.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoAdd rebase test for when upstream has deleted a non-ASCII file
Karl Hasselström [Mon, 2 Jun 2008 23:40:45 +0000 (01:40 +0200)]
Add rebase test for when upstream has deleted a non-ASCII file

Test that stg rebase can handle upstream deleting a file with a
non-ASCII name. It currently can't.

Bug spotted by Jakub Narebski <jnareb@gmail.com>.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoConvert "export" to the new infrastructure
Catalin Marinas [Wed, 28 May 2008 21:02:02 +0000 (22:02 +0100)]
Convert "export" to the new infrastructure

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoConvert "top" to the new infrastructure
Catalin Marinas [Wed, 28 May 2008 21:02:02 +0000 (22:02 +0100)]
Convert "top" to the new infrastructure

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoFix error in status.py when calling git.resolved
Catalin Marinas [Wed, 28 May 2008 21:02:02 +0000 (22:02 +0100)]
Fix error in status.py when calling git.resolved

It was using a generator instead of a list and it failed later in
Run.xargs().

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow the Repository.get_stack() to get a default argument
Catalin Marinas [Wed, 28 May 2008 21:02:01 +0000 (22:02 +0100)]
Allow the Repository.get_stack() to get a default argument

If no argument or if it is None, it returns the current stack. This is
useful for many of the functions taking a --branch option.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoRewrite the "series" command for the new infrastructure
Catalin Marinas [Wed, 28 May 2008 21:02:01 +0000 (22:02 +0100)]
Rewrite the "series" command for the new infrastructure

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoRefactor the Commitdata class to CommitData
Catalin Marinas [Wed, 28 May 2008 21:02:01 +0000 (22:02 +0100)]
Refactor the Commitdata class to CommitData

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoMerge branch 'stable'
Catalin Marinas [Tue, 27 May 2008 22:18:22 +0000 (23:18 +0100)]
Merge branch 'stable'

Conflicts:

t/t2700-refresh.sh

16 years agoFix "refresh" failure with moved files (bug 11661)
Catalin Marinas [Tue, 27 May 2008 21:47:49 +0000 (22:47 +0100)]
Fix "refresh" failure with moved files (bug 11661)

This patch fixes the git.tree_status() function to not pass missing files
to the git-diff-files command which crashes in weird ways (see the bug
report on gna.org).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAdd property with a list of all patch names
Karl Hasselström [Tue, 20 May 2008 21:33:25 +0000 (23:33 +0200)]
Add property with a list of all patch names

This simplifies the code in a number of places.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoPrevent most commands from running when there are conflicts
Karl Hasselström [Tue, 20 May 2008 21:33:25 +0000 (23:33 +0200)]
Prevent most commands from running when there are conflicts

When there are conflicts, we want most commands to fail, since the
conflicts conceptually belong to the topmost patch. git read-tree
already checks this for us when we check out a new tree, but there are
operations where the top tree stays the same, e.g. stg new.

This patch inserts a conflict check when the tree to check out is the
same. By default, conflicts will prevent the checkout from succeeding,
but commands can choose to override this if the same patch stays on
top (for some definition of "same").

This change only affects the new-infrastructure commands; the others
always refuse to run when there are local changes of any kind.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: delete patches
Karl Hasselström [Tue, 20 May 2008 21:33:24 +0000 (23:33 +0200)]
Emacs mode: delete patches

Teach the emacs mode to delete patches. It will delete the selected
patches, or, if no patches are selected, the patch at point (and if
there is no patch at point, complain). Before deleting, it will ask
for confirmation.

Thanks to David Kågedal <davidk@lysator.liu.se> for lots of elisp
help.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoConvert "stg delete" to the new infrastructure
Karl Hasselström [Tue, 20 May 2008 21:33:24 +0000 (23:33 +0200)]
Convert "stg delete" to the new infrastructure

In the process, it gains the ability to delete any applied patch (not
just the topmost one, like before), even when deleting patches from
another branch. (However, when deleting patches on another branch, we
obviously can't represent a conflict in the index and worktree, so any
conflicts will make the operation abort.)

One of the t1600 subtests made sure that we couldn't delete
non-topmost patches, and had to be corrected.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: use "stg new --file"
Karl Hasselström [Tue, 20 May 2008 21:33:24 +0000 (23:33 +0200)]
Emacs mode: use "stg new --file"

Creating a new patch is a great deal easier now that "stg new" has a
--file flag.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoLet "stg new" support more message options
Karl Hasselström [Tue, 20 May 2008 21:33:24 +0000 (23:33 +0200)]
Let "stg new" support more message options

Let "stg new" support --file and --save-template in addition to
--message. This is useful for scripting.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRefactor --author/--committer options
Karl Hasselström [Tue, 20 May 2008 21:33:24 +0000 (23:33 +0200)]
Refactor --author/--committer options

This refactoring is specific to the new infrastructure, so only new
and edit use it currently, but other commands can start using it as
they are converted.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoConvert "stg new" to the new infrastructure
Karl Hasselström [Tue, 20 May 2008 21:33:24 +0000 (23:33 +0200)]
Convert "stg new" to the new infrastructure

This results in considerable code expansion, which is a sure sign that
something needs to be abstracted away -- but to keep things simple,
those transformations come as separate patches.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoDisable patchlog test for "stg new"
Karl Hasselström [Tue, 20 May 2008 21:33:24 +0000 (23:33 +0200)]
Disable patchlog test for "stg new"

This will be broken by the "stg new" rewrite, so stop testing it.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoTry the built-in version string before git-describe
Karl Hasselström [Tue, 20 May 2008 21:33:12 +0000 (23:33 +0200)]
Try the built-in version string before git-describe

Try to get the built-in version string first, and fall back to git
describe if there is no built-in string, instead of the other way
around. This makes computing the version string much cheaper in the
common case (whenever StGit is not run directly from a git-controlled
tree).

In order for this to work when StGit _is_ run directly from a
git-controlled tree, setup.py has to delete the builtin version file
once the installation process is over. (Otherwise, the StGit version
in a git-controlled tree would be frozen at whatever value it happened
to have when setup.py was last run.)

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMerge branch 'stable'
Catalin Marinas [Mon, 19 May 2008 21:56:31 +0000 (22:56 +0100)]
Merge branch 'stable'

16 years agoAllow export to write unapplied files as well
Catalin Marinas [Mon, 19 May 2008 21:54:27 +0000 (22:54 +0100)]
Allow export to write unapplied files as well

This was an artificial limit which upset many people (including me).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoEmacs mode: automatically cd up to root of worktree
Karl Hasselström [Wed, 14 May 2008 00:04:32 +0000 (02:04 +0200)]
Emacs mode: automatically cd up to root of worktree

git's emacs mode automatically finds the root of the worktree, so that
the user doesn't have to. Teach StGit's emacs mode the same trick by
borrowing the git-get-top-dir function from git.

The borrowed code was written by Alexandre Julliard <julliard@winehq.org>.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoBetter StGit version tracking
Karl Hasselström [Tue, 13 May 2008 21:50:31 +0000 (23:50 +0200)]
Better StGit version tracking

Instead of claiming to be the latest released version (really, a
hardcoded string that we hope is the latest released version), run git
describe to figure out what version we are, just like git does. Fall
back to a hardcoded value that is generated at install time, or
supplied in a release tarball.

Currently, we have to give git describe the --tags flag, since StGit
release tags are lightweight tags. This means we're going to pick up
any lightweight tags the user makes, which isn't ideal. The solution
is to start making annotated release tags, and then remove that flag.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoImport version to a separate namespace
Karl Hasselström [Tue, 13 May 2008 21:50:27 +0000 (23:50 +0200)]
Import version to a separate namespace

The set of names we need from the version module is about to get too
large to list explicitly, but we don't want to pollute the local
namespace with every name from version. So do a qualified import of
the module.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRemove "stg" from start of log messages
Karl Hasselström [Thu, 8 May 2008 22:24:11 +0000 (00:24 +0200)]
Remove "stg" from start of log messages

It's entirely redundant.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoUse test_cmp instead of diff -u in the test suite
Karl Hasselström [Sun, 20 Apr 2008 13:17:42 +0000 (15:17 +0200)]
Use test_cmp instead of diff -u in the test suite

Since diff -u isn't available everywhere, and the user might want to
use something else.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoGet rid of backticks in test-lib.sh
Karl Hasselström [Sun, 20 Apr 2008 13:17:42 +0000 (15:17 +0200)]
Get rid of backticks in test-lib.sh

The $(...) notation is just plain nicer.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoSteal more test-lib.sh updates from git
Karl Hasselström [Sun, 20 Apr 2008 13:17:41 +0000 (15:17 +0200)]
Steal more test-lib.sh updates from git

This patch incorporates the updates that were made to git's
test-lib.sh from revision v1.2.2-66-g6643688 up to revision
v1.5.5-67-g9a49e00. A few manual adjustments had to be made -- for
example, the StGit tests assume that the repository starts out with an
initial commit, and there's no need to try to get hold of a git binary
other than the one reachable via $PATH. And the test_must_fail helper
function is not that useful to us, since a crashing Python program
won't kill the entire Python interpreter.

The main improvement is that the test script output is now in color!

Shortlog of the imported changes:

  Alex Riesen (2):
        Fix permissions on test scripts
        Do no colorify test output if stdout is not a terminal

  Christian Couder (1):
        Trace into a file or an open fd and refactor tracing code.

  Clemens Buchacher (1):
        http-push: add regression tests

  Eric Wong (3):
        tests: Set EDITOR=: and VISUAL=: globally
        test-lib: quiet down init-db output for tests
        Update tests to use test-chmtime

  Gerrit Pape (1):
        Set $HOME for selftests

  Jeff King (3):
        fix config reading in tests
        use build-time SHELL_PATH in test scripts
        add test_cmp function for test scripts

  Johannes Schindelin (2):
        Introduce GIT_TEMPLATE_DIR
        Make tests independent of global config files

  Johannes Sixt (1):
        test-lib.sh: A command dying due to a signal is an unexpected failure.

  Josh Triplett (1):
        Fall back to $EMAIL for missing GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL

  Junio C Hamano (26):
        Perl interface: make testsuite work again.
        Perly Git: make sure we do test the freshly built one.
        test-lib: unset GIT_TRACE
        Merge branch 'ml/trace'
        Merge branch 'master' into pb/gitpm
        Deprecate merge-recursive.py
        Merge branch 'jc/gitpm'
        remove merge-recursive-old
        fix testsuite: make sure they use templates freshly built from the source
        Revert "fix testsuite: make sure they use templates freshly built from the source"
        GIT_SKIP_TESTS: allow users to omit tests that are known to break
        t5400 send-pack test: try a bit more nontrivial transfer.
        Fix timestamp for test-tick
        t/test-lib.sh: Protect ourselves from common misconfiguration
        War on whitespace
        Merge branch 'ei/worktree+filter'
        Unset GIT_EDITOR while running tests.
        Sane use of test_expect_failure
        test: reword the final message of tests with known breakages
        tests: introduce test_must_fail
        Merge branch 'cb/http-test'
        tests: introduce test_must_fail
        test-lib: fix TERM to dumb for test repeatability
        Merge branch 'maint'
        Test: catch if trash cannot be removed
        test_must_fail: 129 is a valid error code from usage()

  Martin Waitz (1):
        test-lib: separate individual test better in verbose mode.

  Matthias Lederhofer (1):
        introduce GIT_WORK_TREE to specify the work tree

  Michele Ballabio (2):
        test-lib.sh: move error line after error() declaration
        Fix typo in a comment in t/test-lib.sh

  Nicolas Pitre (1):
        use 'init' instead of 'init-db' for shipped docs and tools

  Petr Baudis (1):
        Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @INC munging

  Pierre Habouzit (2):
        Add some fancy colors in the test library when terminal supports it.
        Support a --quiet option in the test-suite.

  Robin Rosenberg (1):
        Quote arguments to tr in test-lib

  Shawn O. Pearce (1):
        Default GIT_MERGE_VERBOSITY to 5 during tests.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoUse hardcoded author and committer names in tests
Karl Hasselström [Sun, 20 Apr 2008 13:17:41 +0000 (15:17 +0200)]
Use hardcoded author and committer names in tests

There seems to be no reason for these to stay commented out -- in
fact, commit v0.12-4-g5cd9e87 which introduced these lines seems to
have left them commented out by mistake.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoHandle commandline parsing errors gracefully
Karl Hasselström [Sun, 20 Apr 2008 13:17:17 +0000 (15:17 +0200)]
Handle commandline parsing errors gracefully

The commandline option parser raises SystemExit after having explained
to the user what she did wrong. A recent refactoring introduced a
catch-all "except:" at the top level, which caught the SystemExit and
printed a traceback.

Let's just simply exit instead, like we used to.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMerge branch 'stable'
Catalin Marinas [Thu, 17 Apr 2008 20:50:14 +0000 (21:50 +0100)]
Merge branch 'stable'

16 years agoFix the sync'ing of unapplied patches only
Catalin Marinas [Thu, 17 Apr 2008 20:49:29 +0000 (21:49 +0100)]
Fix the sync'ing of unapplied patches only

When only unapplied patches are to be sync'ed, the command failed
because the first patch was trying to be pushed twice.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoIf a patch is not changed when pushing, reuse the same commit object
Karl Hasselström [Tue, 15 Apr 2008 20:04:14 +0000 (22:04 +0200)]
If a patch is not changed when pushing, reuse the same commit object

It should be marginally faster since we don't have to create a new
commit object, but mostly it's a cleanliness issue: rewriting history
when we don't have to is bad.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoemacs mode: handle "stg status" output with #
Karl Hasselström [Mon, 14 Apr 2008 23:18:53 +0000 (01:18 +0200)]
emacs mode: handle "stg status" output with #

Recently, "stg status" started separating patch names and descriptions
with # rather than |. This broke some parts of the emacs mode, such as
coloring and patch selection.

This patch makes the emacs mode accept either delimiter.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoLog environment and cwd as well as the actual command
Karl Hasselström [Mon, 14 Apr 2008 23:18:53 +0000 (01:18 +0200)]
Log environment and cwd as well as the actual command

When debugging subprocess calls (with STGIT_SUBPROCESS_LOG=debug),
it's important to know the environment and working directory we pass
to the subprocess, not just the command-line parameters.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoDon't both change directory and set GIT_WORK_TREE
Karl Hasselström [Mon, 14 Apr 2008 23:18:53 +0000 (01:18 +0200)]
Don't both change directory and set GIT_WORK_TREE

We used to both change the working directory and set GIT_WORK_TREE
when calling git merge-recursive. This works with older versions of
git (up to and including 1.5.4.x, or thereabouts) because
merge-recursive ignores GIT_WORK_TREE. It stopped doing that sometime
just before 1.5.5, which broke StGit. (Given both GIT_WORK_TREE=".."
and cwd "..", it assumed the work tree was at "../..", instead of just
".." like we intended. This made t2800 fail.)

Just dropping the cd would solve the problem for new gits, but would
break StGit with older gits. But it works in both cases if we keep the
cd, and unconditionally set GIT_WORK_TREE=".". So this patch does
precisely that.

(git read-tree -u -m is also called from IndexAndWorktree, and it
 seems to always ignore GIT_WORK_TREE just like merge-recursive used
 to do. The patch fixes all calls made from IndexAndWorktree, so we're
 good if read-tree starts heeding GIT_WORK_TREE in the future.)

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMerge branch 'stable' into stable-master-merge
Karl Hasselström [Mon, 14 Apr 2008 23:18:35 +0000 (01:18 +0200)]
Merge branch 'stable' into stable-master-merge

16 years agoMake t1003-new executable
Karl Hasselström [Mon, 14 Apr 2008 23:16:49 +0000 (01:16 +0200)]
Make t1003-new executable

It's not required, strictly speaking, but it's convenient. And
consistent with the other tests.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoFix problems in t1000-branch-create
Karl Hasselström [Sun, 13 Apr 2008 13:38:47 +0000 (15:38 +0200)]
Fix problems in t1000-branch-create

There were a number of problems with t1000-branch-create:

  * It assumed that refs were not packed. I added calls to show-ref to
    spot any packed refs.

  * It reused the same name for several consecutive branch creation
    tests. This causes a domino effect if one of the subtests fail. I
    made the subtests use different names.

  * It tried to make sure that we couldn't create a branch if there
    was a broken ref by the same name. Unfortunately that test fails
    -- we don't create the branch, but we point HEAD to it. This
    causes many subsequent operations to fail. I marked this test as a
    known failure, and added some reset code so that subsequent
    subtests don't die because of this.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMerge branch 'stable'
Catalin Marinas [Tue, 25 Mar 2008 20:40:22 +0000 (20:40 +0000)]
Merge branch 'stable'

16 years agoRelease 0.14.2 v0.14.2
Catalin Marinas [Mon, 24 Mar 2008 19:23:49 +0000 (19:23 +0000)]
Release 0.14.2

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agostg mail crashes when there is no patch description
Angus Salkeld [Mon, 24 Mar 2008 18:54:28 +0000 (18:54 +0000)]
stg mail crashes when there is no patch description

The error is:
File "/usr/lib/python2.4/site-packages/stgit/commands/mail.py", line
397, in __build_message
descr = p.get_description().strip()
AttributeError: 'NoneType' object has no attribute 'strip'

This patch tries to handle this a bit better by setting the
description to "<empty message>" and forcing the edit_patches option
on.

16 years agoBetter "stg rebase" help text
Alex Chiang [Mon, 24 Mar 2008 18:54:10 +0000 (18:54 +0000)]
Better "stg rebase" help text

Enhance rebase help string by providing guidance on merge conflict
resolution during a rebase.

Based on text suggested by Catalin Marinas.

Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoTest the 'stg rename' command
Onno Kortmann [Mon, 24 Mar 2008 18:53:49 +0000 (18:53 +0000)]
Test the 'stg rename' command

This just tests the few basic cases of the stg rename command.

Signed-off-by: Onno Kortmann <onno@gmx.net>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoSimple rename of top-most patch
Onno Kortmann [Mon, 24 Mar 2008 18:53:37 +0000 (18:53 +0000)]
Simple rename of top-most patch

Allow renaming of the top-most patch just by calling stg rename
<new-patch-name>, instead of stg rename <old> <new>. This is for
example helpful for those people who always have a typo or two in
their patch names.

Signed-off-by: Onno Kortmann <onno@gmx.net>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoFix "stg branch --delete" on a nonexistent branch
Toby Allsopp [Mon, 24 Mar 2008 18:53:13 +0000 (18:53 +0000)]
Fix "stg branch --delete" on a nonexistent branch

Before this patch, I get the following:

 $ stg branch --delete tmp
 Deleting branch "tmp" ... Traceback (most recent call last):
   File "/usr/bin/stg", line 43, in ?
     main()
   File "/var/lib/python-support/python2.4/stgit/main.py", line 281, in main
     command.func(parser, options, args)
   File "/var/lib/python-support/python2.4/stgit/commands/branch.py", line 190, in func
     __delete_branch(args[0], options.force)
   File "/var/lib/python-support/python2.4/stgit/commands/branch.py", line 100, in __delete_branch
     doomed.delete(force)
   File "/var/lib/python-support/python2.4/stgit/stack.py", line 758, in delete
     except GitException:
 NameError: global name 'GitException' is not defined

After it, I get:

 Deleting branch "tmp" ...
   Warning: Could not delete branch "tmp"
 done

Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMake documentation less confusing
Karl Hasselström [Mon, 24 Mar 2008 18:50:47 +0000 (18:50 +0000)]
Make documentation less confusing

It's not just by default "stg new" doesn't do a refresh -- it never
does.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoreplace "git repo-config" usage by "git config"
Peter Oberndorfer [Mon, 24 Mar 2008 18:47:38 +0000 (18:47 +0000)]
replace "git repo-config" usage by "git config"

This is necessary since "git repo-config" will be removed soon.

Signed-off-by: Peter Oberndorfer <kumbayo84@arcor.de>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRemove a newline from the e-mail template
Catalin Marinas [Mon, 24 Mar 2008 18:46:27 +0000 (18:46 +0000)]
Remove a newline from the e-mail template

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow picking of one commit id
Catalin Marinas [Mon, 24 Mar 2008 18:42:57 +0000 (18:42 +0000)]
Allow picking of one commit id

This was broken by a previous patch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow picking of one commit id
Catalin Marinas [Mon, 24 Mar 2008 18:42:09 +0000 (18:42 +0000)]
Allow picking of one commit id

This was broken by a previous patch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoRemove the reordering side-effect of the latter sync changes
Catalin Marinas [Mon, 24 Mar 2008 18:30:56 +0000 (18:30 +0000)]
Remove the reordering side-effect of the latter sync changes

If only some of the patches were specified for syncing, the command had the
side effect of reordering the patches in the stack.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoRemove the reordering side-effect of the latter sync changes
Catalin Marinas [Mon, 24 Mar 2008 18:30:25 +0000 (18:30 +0000)]
Remove the reordering side-effect of the latter sync changes

If only some of the patches were specified for syncing, the command had the
side effect of reordering the patches in the stack.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoFix sync to push the popped patches back after sync'ing
Catalin Marinas [Mon, 24 Mar 2008 11:19:41 +0000 (11:19 +0000)]
Fix sync to push the popped patches back after sync'ing

The t2000-sync.py test was failing after the previous change to this command.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoFix sync to push the popped patches back after sync'ing
Catalin Marinas [Mon, 24 Mar 2008 11:16:59 +0000 (11:16 +0000)]
Fix sync to push the popped patches back after sync'ing

The t2000-sync.py test was failing after the previous change to this command.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAdd a boundary to parse_patches in pick.py
Catalin Marinas [Mon, 24 Mar 2008 10:19:49 +0000 (10:19 +0000)]
Add a boundary to parse_patches in pick.py

By specifying 'stg pick -B aaa ..', stgit would pick both applied and unapplied patches. Simply set the boundary to len(applied) so that unapplied patches have to be picked explicitly.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAdd a boundary to parse_patches in pick.py
Catalin Marinas [Mon, 24 Mar 2008 10:19:28 +0000 (10:19 +0000)]
Add a boundary to parse_patches in pick.py

By specifying 'stg pick -B aaa ..', stgit would pick both applied and unapplied patches. Simply set the boundary to len(applied) so that unapplied patches have to be picked explicitly.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoRefuse to send empty patches
Catalin Marinas [Mon, 24 Mar 2008 10:16:05 +0000 (10:16 +0000)]
Refuse to send empty patches

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoSet umask to 0022 during the setup.py execution
Catalin Marinas [Mon, 24 Mar 2008 10:16:05 +0000 (10:16 +0000)]
Set umask to 0022 during the setup.py execution

This allows template files to be installed with the proper rights.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoRefuse to send empty patches
Catalin Marinas [Mon, 24 Mar 2008 09:51:39 +0000 (09:51 +0000)]
Refuse to send empty patches

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoSet umask to 0022 during the setup.py execution
Catalin Marinas [Mon, 24 Mar 2008 09:38:30 +0000 (09:38 +0000)]
Set umask to 0022 during the setup.py execution

This allows template files to be installed with the proper rights.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoModify 'series' to use '#' instead of '|'
Catalin Marinas [Thu, 20 Mar 2008 23:12:33 +0000 (23:12 +0000)]
Modify 'series' to use '#' instead of '|'

This is useful if the output is dumped to a file which is later used
for commands like 'float'. The text after '#' is considered a comment
and ignored.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow the synchronisation of the unapplied patches
Catalin Marinas [Thu, 20 Mar 2008 23:12:33 +0000 (23:12 +0000)]
Allow the synchronisation of the unapplied patches

This is useful to avoid pushing patches when a sync operation failed
and needs to be resumed.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoCheck for unnecessary push/pop in 'float'
Catalin Marinas [Thu, 20 Mar 2008 23:12:33 +0000 (23:12 +0000)]
Check for unnecessary push/pop in 'float'

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow pick to import multiple patches
Catalin Marinas [Thu, 20 Mar 2008 23:12:32 +0000 (23:12 +0000)]
Allow pick to import multiple patches

This patch allows multiple patches on the "pick" command line.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoDon't set the default authdate if none specified
Catalin Marinas [Thu, 20 Mar 2008 23:12:32 +0000 (23:12 +0000)]
Don't set the default authdate if none specified

This way, we allow a patch editing to remove an existing date by not
specifying it.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoModify 'series' to use '#' instead of '|'
Catalin Marinas [Thu, 20 Mar 2008 23:12:12 +0000 (23:12 +0000)]
Modify 'series' to use '#' instead of '|'

This is useful if the output is dumped to a file which is later used
for commands like 'float'. The text after '#' is considered a comment
and ignored.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow the synchronisation of the unapplied patches
Catalin Marinas [Thu, 20 Mar 2008 23:12:12 +0000 (23:12 +0000)]
Allow the synchronisation of the unapplied patches

This is useful to avoid pushing patches when a sync operation failed
and needs to be resumed.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoCheck for unnecessary push/pop in 'float'
Catalin Marinas [Thu, 20 Mar 2008 23:12:12 +0000 (23:12 +0000)]
Check for unnecessary push/pop in 'float'

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoAllow pick to import multiple patches
Catalin Marinas [Thu, 20 Mar 2008 23:12:12 +0000 (23:12 +0000)]
Allow pick to import multiple patches

This patch allows multiple patches on the "pick" command line.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoDon't set the default authdate if none specified
Catalin Marinas [Thu, 20 Mar 2008 23:12:11 +0000 (23:12 +0000)]
Don't set the default authdate if none specified

This way, we allow a patch editing to remove an existing date by not
specifying it.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
16 years agoHandle failed pushes differently depending on cause
Karl Hasselström [Thu, 20 Mar 2008 23:12:11 +0000 (23:12 +0000)]
Handle failed pushes differently depending on cause

Specifically, if the push failed because of a merge conflict, the
patch should be applied but empty; and if it fails for any other
reason (such as a too-dirty worktree), the patch should not be
applied.

This fixes the data loss bug tested for by t3000.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoNew test: conflicting push in dirty worktree
Karl Hasselström [Thu, 20 Mar 2008 23:12:11 +0000 (23:12 +0000)]
New test: conflicting push in dirty worktree

When the result of a conflicting push can't be represented in the
worktree because the worktree is dirty, the push should be aborted.
Similarly, the push should be aborted if we have to do the merge in
the worktree, but can't because the worktree is dirty.

Add a new test that tests for this. It currently fails, in a bad way:
the contents of the pushed patch is lost.

(The test uses goto instead of push, because push doesn't use the new
infrastructure yet. And old-infrastructure commands never have this
bug, because they refuse to run with a dirty worktree.)

This bug was found by Erik Sandberg <mandolaerik@gmail.com>, who also
came up with the minimal test case that I turned into this new test.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMake sure that we only uncommit commits with exactly one parent
Karl Hasselström [Thu, 20 Mar 2008 23:12:11 +0000 (23:12 +0000)]
Make sure that we only uncommit commits with exactly one parent

If we encounter a commit with 0, or 2 or more parents, fail with a
nice error message instead of crashing.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoTry uncommitting a commit with not exactly one parent
Karl Hasselström [Thu, 20 Mar 2008 23:12:10 +0000 (23:12 +0000)]
Try uncommitting a commit with not exactly one parent

This should fail cleanly -- and in fact it does. Except for printing
an assertion backtrace instead of a nice error message. (This is a
regression introduced by the conversion of "stg uncommit" to the new
infrastructure.)

Found by Erik Sandberg <mandolaerik@gmail.com>.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoMake sure patches with no parents have an empty list of parents
Karl Hasselström [Thu, 20 Mar 2008 23:12:10 +0000 (23:12 +0000)]
Make sure patches with no parents have an empty list of parents

They used to have None instead of an empty list, which was
inconsistent. (It went undetected for quite a while because StGit
seldom needs to handle initial commits.)

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoUse a special exit code for bugs
Karl Hasselström [Thu, 20 Mar 2008 23:12:10 +0000 (23:12 +0000)]
Use a special exit code for bugs

Use a special exit code (4) for any error condition that indicates a
bug in StGit. This will be useful in the test suite.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agostg mail crashes when there is no patch description
Angus Salkeld [Thu, 20 Mar 2008 23:12:10 +0000 (23:12 +0000)]
stg mail crashes when there is no patch description

The error is:
File "/usr/lib/python2.4/site-packages/stgit/commands/mail.py", line
397, in __build_message
descr = p.get_description().strip()
AttributeError: 'NoneType' object has no attribute 'strip'

This patch tries to handle this a bit better by setting the
description to "<empty message>" and forcing the edit_patches option
on.

16 years agoBetter "stg rebase" help text
Alex Chiang [Thu, 20 Mar 2008 23:12:10 +0000 (23:12 +0000)]
Better "stg rebase" help text

Enhance rebase help string by providing guidance on merge conflict
resolution during a rebase.

Based on text suggested by Catalin Marinas.

Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoTest the 'stg rename' command
Onno Kortmann [Thu, 21 Feb 2008 21:43:18 +0000 (22:43 +0100)]
Test the 'stg rename' command

This just tests the few basic cases of the stg rename command.

Signed-off-by: Onno Kortmann <onno@gmx.net>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoSimple rename of top-most patch
Onno Kortmann [Thu, 21 Feb 2008 21:42:51 +0000 (22:42 +0100)]
Simple rename of top-most patch

Allow renaming of the top-most patch just by calling stg rename
<new-patch-name>, instead of stg rename <old> <new>. This is for
example helpful for those people who always have a typo or two in
their patch names.

Signed-off-by: Onno Kortmann <onno@gmx.net>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoFix "stg branch --delete" on a nonexistent branch
Toby Allsopp [Wed, 13 Feb 2008 22:25:29 +0000 (11:25 +1300)]
Fix "stg branch --delete" on a nonexistent branch

Before this patch, I get the following:

 $ stg branch --delete tmp
 Deleting branch "tmp" ... Traceback (most recent call last):
   File "/usr/bin/stg", line 43, in ?
     main()
   File "/var/lib/python-support/python2.4/stgit/main.py", line 281, in main
     command.func(parser, options, args)
   File "/var/lib/python-support/python2.4/stgit/commands/branch.py", line 190, in func
     __delete_branch(args[0], options.force)
   File "/var/lib/python-support/python2.4/stgit/commands/branch.py", line 100, in __delete_branch
     doomed.delete(force)
   File "/var/lib/python-support/python2.4/stgit/stack.py", line 758, in delete
     except GitException:
 NameError: global name 'GitException' is not defined

After it, I get:

 Deleting branch "tmp" ...
   Warning: Could not delete branch "tmp"
 done

Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz>
Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: change "stg repair" binding
Karl Hasselström [Mon, 11 Feb 2008 22:21:53 +0000 (23:21 +0100)]
Emacs mode: change "stg repair" binding

It used to be C-r, but that's commonly used for reverse searching, so
use R instead.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoRemove unused data field
Karl Hasselström [Tue, 12 Feb 2008 02:15:53 +0000 (03:15 +0100)]
Remove unused data field

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoEmacs mode: It's possible to edit unapplied patches now
Karl Hasselström [Thu, 31 Jan 2008 14:36:58 +0000 (15:36 +0100)]
Emacs mode: It's possible to edit unapplied patches now

With the rewrite, "stg edit" gained the ability to edit unapplied
patches, so the emacs mode no longer has to check that a patch is
applied before trying to edit it.

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoConvert "stg edit" to the new infrastructure
Karl Hasselström [Fri, 1 Feb 2008 03:37:56 +0000 (04:37 +0100)]
Convert "stg edit" to the new infrastructure

The --annotate and --undo switches were dropped in the conversion.
--annotate could be re-added, but --undo is more problematic since the
command will now rewrite any applied patches on top of the edited
patch. It seems best to leave this job to the fabled general undo
command, expected Real Soon Now.

In addition to the usual improvements from the new infrastructure,
this patch has some additional benefits:

  * There's a new -e/--edit flag, which forces interactive editing
    even if options such as --sign or --author are given. (Normally,
    interactive editing is skipped if the patch is modified with a
    commandline option.)

  * It's now possible to edit any patch, including unapplied patches.
    Even diff editing works for all patches, including unapplied
    patches. (In fact, editing unapplied patches is slightly safer,
    since they don't mind a dirty index/worktree.)

Signed-off-by: Karl Hasselström <kha@treskal.com>
16 years agoParse the date instead of treating it as an opaque string
Karl Hasselström [Fri, 1 Feb 2008 05:12:17 +0000 (06:12 +0100)]
Parse the date instead of treating it as an opaque string

This is needed for when we want to display it, since the
seconds-since-the-epoch format isn't that human-friendly.

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