stgit
18 years agoAdd an option to "stg branch" to convert the internal format
Chuck Lever [Sun, 29 Jan 2006 18:14:01 +0000 (13:14 -0500)]
Add an option to "stg branch" to convert the internal format

Previous patch adds support for a separate patch directory in each branch.
Let's give users an option to convert their old branches to new style ones
and back.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoUse a separate directory for patches under each branch subdir
Chuck Lever [Sun, 29 Jan 2006 18:13:59 +0000 (13:13 -0500)]
Use a separate directory for patches under each branch subdir

Currently you can't specify a patch name that matches the name of one of
the stgit special files under .git/patches/<branch-name>.  Let's use a
new subdirectory under .git/patches/<branch-name> to contain just the
patch directories to remove this limitation.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoTreat "stg --help cmd" and "stg help cmd" like "stg cmd
Pavel Roskin [Fri, 27 Jan 2006 05:17:28 +0000 (00:17 -0500)]
Treat "stg --help cmd" and "stg help cmd" like "stg cmd

User's intention is perfectly clear if "-h", "--help" or "help" is
followed by a valid command - show help for that command.

Signed-off-by: Pavel Roskin <proski@gnu.org>
18 years ago"stg pull" says "popping all patches" even when it doesn't
Chuck Lever [Sun, 29 Jan 2006 18:08:36 +0000 (13:08 -0500)]
"stg pull" says "popping all patches" even when it doesn't

Running "stg pull" says it pops all patches, but it really means it is
popping all *applied* patches.  Change the informational message to match
the behavior.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agostg export: check if there are any patches to export
Pavel Roskin [Tue, 24 Jan 2006 21:25:41 +0000 (16:25 -0500)]
stg export: check if there are any patches to export

Otherwise, stg export fails with "list index out of range"

Signed-off-by: Pavel Roskin <proski@gnu.org>
18 years agoAllow patch refreshing for some files only
Catalin Marinas [Mon, 23 Jan 2006 17:37:31 +0000 (17:37 +0000)]
Allow patch refreshing for some files only

The patch allows the 'refresh' command to accept files as arguments. Only
the local changes to the specified files will be considered for inclusion
in the patch to be refreshed.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoMerge branch 'master' of http://homepage.ntlworld.com/cmarinas/stgit
Catalin Marinas [Mon, 23 Jan 2006 14:37:16 +0000 (14:37 +0000)]
Merge branch 'master' of homepage.ntlworld.com/cmarinas/stgit

18 years agoRemove the --force option for new
Catalin Marinas [Sun, 22 Jan 2006 08:56:24 +0000 (08:56 +0000)]
Remove the --force option for new

The default behaviour is now the same as the previous 'new --force' since
most of the people (and myself) first change the tree and run 'new'
afterwards to create the patch. Note that the newly created patch is empty
even if there are local changes. A 'refresh' command is needed to add the
local changes to the patch.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoFix the 'status --reset' for individual files
Catalin Marinas [Thu, 19 Jan 2006 15:01:29 +0000 (15:01 +0000)]
Fix the 'status --reset' for individual files

By default, status --reset calls resolved which updates the tree index and
the git-checkout-index -f does not overwrite the files anymore. This patch
explicitely resets the files to the HEAD tree id.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoMake tutorial a valid asciidoc article.
Pavel Roskin [Sat, 21 Jan 2006 22:21:59 +0000 (22:21 +0000)]
Make tutorial a valid asciidoc article.

There should be only one level 0 title, so redefine underline rules in
asciidoc.conf to keep the existing underlines when possible.  Form a new
level 1 part "Technical Information" from the text at the end.  Make
introduction a preamble - it's too short to be a level 1 section.

Add doc/Makefile to process the tutorial automatically.  make needs to
be run explicitly in the doc directory.

Signed-off-by: Pavel Roskin <proski@gnu.org>
18 years agoMerge branch 'master' of http://homepage.ntlworld.com/cmarinas/stgit
Catalin Marinas [Fri, 13 Jan 2006 10:25:28 +0000 (10:25 +0000)]
Merge branch 'master' of homepage.ntlworld.com/cmarinas/stgit

18 years agoFix the clone command failure
Catalin Marinas [Thu, 12 Jan 2006 21:04:30 +0000 (21:04 +0000)]
Fix the clone command failure

The clone command fails because there is no GIT tree available, which is
wrong. The patch fixes the Series.__init__() function and also creates a
new Series object in clone.py once a GIT tree was initialised.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agostgit: typo fixes
Pavel Roskin [Tue, 10 Jan 2006 17:14:00 +0000 (12:14 -0500)]
stgit: typo fixes

Signed-off-by: Pavel Roskin <proski@gnu.org>
18 years agoMerge branch 'master' of http://homepage.ntlworld.com/cmarinas/stgit
Catalin Marinas [Sat, 7 Jan 2006 11:45:08 +0000 (11:45 +0000)]
Merge branch 'master' of homepage.ntlworld.com/cmarinas/stgit

18 years agoStgit - gitmergeonefile.py: handle removal vs. changes
Paolo \'Blaisorblade\' Giarrusso [Sun, 13 Nov 2005 19:42:25 +0000 (20:42 +0100)]
Stgit - gitmergeonefile.py: handle removal vs. changes

I just got a "removal vs. changed" conflict, which is unhandled by StGit. That
is taken from git-merge-one-file resolver, but is bad, as stg resolved does not
handle unmerged entries (and probably it should be fixed too).

Sample patch included, but some thought must be done on it (see the comments I
left in).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
18 years ago[trivial] fix spelling typos
Kirill Smelkov [Mon, 2 Jan 2006 11:26:02 +0000 (14:26 +0300)]
[trivial]  fix spelling typos

From: Kirill Smelkov <kirr@landau.phys.spbu.ru>

18 years agoMerge branch 'master' of http://homepage.ntlworld.com/cmarinas/stgit
Catalin Marinas [Fri, 23 Dec 2005 14:34:51 +0000 (14:34 +0000)]
Merge branch 'master' of homepage.ntlworld.com/cmarinas/stgit

18 years agoRelease 0.8 v0.8
Catalin Marinas [Fri, 23 Dec 2005 14:26:15 +0000 (14:26 +0000)]
Release 0.8

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years ago"status --reset" does not restore the deleted files
Catalin Marinas [Thu, 22 Dec 2005 14:26:42 +0000 (14:26 +0000)]
"status --reset" does not restore the deleted files

Actually, the broken code was restoring but deleting them. This was because
git.reset() command was used in the past instead of git.switch(). This
patch fixed it.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoX-Gmail-Received: cccbb3cdc84ae431fe07356861cbfa18540eab00
Catalin Marinas [Thu, 22 Dec 2005 22:17:39 +0000 (22:17 +0000)]
X-Gmail-Received: cccbb3cdc84ae431fe07356861cbfa18540eab00
Delivered-To: catalin.marinas@gmail.com
Received: by 10.70.27.12 with SMTP id a12cs9199wxa; Thu, 22 Dec 2005
        06:26:44 -0800 (PST)
Received: by 10.67.27.6 with SMTP id e6mr472488ugj; Thu, 22 Dec 2005
        06:26:43 -0800 (PST)
Return-Path: <Catalin.Marinas@arm.com>
Received: from cam-admin0.cambridge.arm.com (cam-admin0.cambridge.arm.com
        [193.131.176.58]) by mx.gmail.com with ESMTP id
        y1si659917uge.2005.12.22.06.26.43; Thu, 22 Dec 2005 06:26:43 -0800 (PST)
Received-SPF: pass (gmail.com: best guess record for domain of
        Catalin.Marinas@arm.com designates 193.131.176.58 as permitted sender)
Received: from cam-owa2.Emea.Arm.com (cam-owa2.emea.arm.com [10.1.255.63])
        by cam-admin0.cambridge.arm.com (8.12.10/8.12.10) with ESMTP id
        jBMEQ4JH025197 for <catalin.marinas@gmail.com>; Thu, 22 Dec 2005 14:26:04
        GMT
Received: from localhost.localdomain ([10.1.255.211]) by
        cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 22 Dec 2005
        14:26:42 +0000
From: Catalin Marinas <catalin.marinas@arm.com>
Subject: [PATCH] "status --reset" does not restore the deleted files
Date: Thu, 22 Dec 2005 14:26:42 +0000
To: catalin.marinas@gmail.com
Message-Id: <20051222142642.21281.82698.stgit@localhost.localdomain>
X-OriginalArrivalTime: 22 Dec 2005 14:26:42.0831 (UTC)
        FILETIME=[BAE209F0:01C60703]
X-Evolution-Source: pop://catalin.marinas@pop.gmail.com/
Mime-Version: 1.0

From: Catalin Marinas <catalin.marinas@gmail.com>

Actually, the broken code was restoring but deleting them. This was because
git.reset() command was used in the past instead of git.switch(). This
patch fixed it.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoFix the import command when the body is empty
Catalin Marinas [Tue, 20 Dec 2005 13:20:36 +0000 (13:20 +0000)]
Fix the import command when the body is empty

When the description doesn't have a body, the import command generates an
exception.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoUpdate the TODO information
Catalin Marinas [Fri, 16 Dec 2005 22:21:58 +0000 (22:21 +0000)]
Update the TODO information

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoUpdate the tutorial
Catalin Marinas [Fri, 16 Dec 2005 22:21:43 +0000 (22:21 +0000)]
Update the tutorial

Used the latest information on the StGIT wiki (thanks to Chuck Lever for
updating it).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoremove formatting of git log entry on an imported patch
Trond Myklebust [Thu, 15 Dec 2005 22:36:59 +0000 (22:36 +0000)]
remove formatting of git log entry on an imported patch

The latest stgit changeset appears to reformat patch descriptions on
import (stripping whitespace and adding newlines). I personally much
prefer to be able to control the git log entry myself rather than have a
program dictate the format to me.

The patch also adds support for Date: and From: lines both before and
after the subject (that is a less important change, and can be split out
or thrown out if you prefer).

Signed-off-by: Trond Myklebust <trond.myklebust@fys.uio.no>
18 years agoMake StGIT comply with the author information retrieving
Catalin Marinas [Sun, 11 Dec 2005 09:46:52 +0000 (09:46 +0000)]
Make StGIT comply with the author information retrieving

The import command should search for a "From:" line in the body of the mail
(or patch description) and use the author information from there. The
export and mail commands should automatically add a "From:" line to the
patch description.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoRemove "-r" option on invocations of git-diff-index
Chuck Lever [Thu, 8 Dec 2005 01:48:34 +0000 (20:48 -0500)]
Remove "-r" option on invocations of git-diff-index

Clean-up: the "-r" option on git-diff-index has no effect, and is now
undocumented.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd a brief sentence to the documentation of the "stg branch" command.
Chuck Lever [Thu, 8 Dec 2005 01:48:32 +0000 (20:48 -0500)]
Add a brief sentence to the documentation of the "stg branch" command.

Add a sentence explaining the default behavior of the "stg branch" command.
Idea by J. Bruce Fields.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd a "--clone" option to "stg branch"
Chuck Lever [Sun, 4 Dec 2005 03:50:19 +0000 (22:50 -0500)]
Add a "--clone" option to "stg branch"

Cloning a branch means creating a new branch and copying all of the
original branch's patches and its base to it.  Like creating a tag,
but this also preserves all the StGIT patches as well.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoFast-forwarding does a git.switch() even when it forwarded no patches
Chuck Lever [Fri, 2 Dec 2005 00:15:13 +0000 (19:15 -0500)]
Fast-forwarding does a git.switch() even when it forwarded no patches

The git.switch() in forward_patches() is not needed when no patches have
been fast forwarded.  This is a significant speed up.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoMake "stg export" save the base commit in the output directory
Chuck Lever [Thu, 1 Dec 2005 02:40:19 +0000 (21:40 -0500)]
Make "stg export" save the base commit in the output directory

When trying to apply a series of diffs that was exported from an StGIT
series, it can be convenient to know exactly which base commit the
patches apply to.  Save that commit as a comment in the "series" file.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd facility to print short list of patches around 'top'
Chuck Lever [Tue, 29 Nov 2005 22:09:47 +0000 (17:09 -0500)]
Add facility to print short list of patches around 'top'

When working in the middle of a very long series, I often find it useful
to have a list of the patches right around the current patch.  Add an
option to "stg series" called "--short" to provide this short list.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years ago"stg series" option to show patch summary descriptions
Chuck Lever [Tue, 29 Nov 2005 22:09:45 +0000 (17:09 -0500)]
"stg series" option to show patch summary descriptions

Optionally show each patch's short description when listing a series.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoUse git-rev-parse to find the local GIT repository
Chuck Lever [Tue, 29 Nov 2005 22:09:40 +0000 (17:09 -0500)]
Use git-rev-parse to find the local GIT repository

Use the latest git-rev-parse technology to allow some StGIT commands to
function correctly in subdirectories of the working directory.

Any command that relies on git-read-tree still doesn't work (changes to
GIT forthcoming).

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAlign branch descriptions in output of "stg branch -l"
Chuck Lever [Tue, 29 Nov 2005 22:09:43 +0000 (17:09 -0500)]
Align branch descriptions in output of "stg branch -l"

When printing branch descriptions, start descriptions in the same column.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAllow 'stg status --reset' to work on individual files
Catalin Marinas [Fri, 18 Nov 2005 16:13:05 +0000 (16:13 +0000)]
Allow 'stg status --reset' to work on individual files

It is useful to be able to only reset some files. This patch allows this.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoFix the unapplied variable missing in export.py
Catalin Marinas [Fri, 18 Nov 2005 13:18:08 +0000 (13:18 +0000)]
Fix the unapplied variable missing in export.py

The bug was introduced by a previous patch for better error reporting.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoUsing delete_patch while deleting a branch is broken
Chuck Lever [Thu, 17 Nov 2005 02:39:30 +0000 (21:39 -0500)]
Using delete_patch while deleting a branch is broken

"stg branch --force --delete" takes forever, and often leaves the
repository in a broken state.  The reason for this is the use of
stack.delete_patch() to delete the patches before removing the series.

The problem is delete_patch() will try to pop the patches, which changes
the head link.  After the branch deletion is complete, HEAD will point to
.git/refs/heads/current-branch, but the contents of current-branch will be
the old base of the deleted branch.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoSeamlessly allow diffs "from" the current working directory
Chuck Lever [Tue, 15 Nov 2005 22:58:47 +0000 (17:58 -0500)]
Seamlessly allow diffs "from" the current working directory

Sometimes I get a big patch B (say it applies to a tree T) that I
want to split up into smaller patches P_1,...,P_n.  Say I've written
patches P_1 and P_2 so far. I'd like a quick way to generate a diff
between T + P_1 + P_2 and T + B, to see what's left to be done.

Currently I use a dirty trick that depends on editing backup files
directly.  If stg already stores trees with the results of applying the
currently unapplied patches, then a way to diff my working tree with one
of those would do the job.

OK, I wrote the above and then discovered:
stg diff -r patchname/top

Does what I want, except reversed.  OK, so stg diff is nifty.  I could
do it with the following patch that changes the empty string to refer to
the current working directory instead of the top of the last applied
patch.  Then

stg diff -r :patchname/top

gives what I want.  Since "/" is already available to refer to the top
of the last applied patch, it makes more sense to me to allow "" for the
current working directory anyway.

IE, there's no way to explicitly refer to the current working directory.
So the only way to get diffs with the current working directory is with a
-r argument that has no colon or trailing slash, in which case you get a
diff *to* the current working directory.

So my proposal gives you an explicit way to refer to the cwd--the empty
string, "".  That seems like a fairly symmetric way to do things, and it
takes advantage of the unused syntax ":patchname" which currently just
gives an error.

Signed-off-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoClean up StGIT's "branch --delete" command
Chuck Lever [Tue, 15 Nov 2005 22:52:56 +0000 (17:52 -0500)]
Clean up StGIT's "branch --delete" command

os.path.isfile is not the same as os.path.exists.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoCleanup: remove unused variable
Chuck Lever [Tue, 15 Nov 2005 22:52:54 +0000 (17:52 -0500)]
Cleanup: remove unused variable

Get rid of git.py:head_link , as it is no longer used by any part of
StGIT.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoFix a typo in the "add" command's documentation
Chuck Lever [Mon, 14 Nov 2005 16:51:02 +0000 (11:51 -0500)]
Fix a typo in the "add" command's documentation

Signed-off-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoFix a typo in "stg pick"
Chuck Lever [Mon, 14 Nov 2005 16:50:59 +0000 (11:50 -0500)]
Fix a typo in "stg pick"

"Unknown" is misspelled.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agouse "crt_series.get_branch()" instead of "git.get_head_file()"
Chuck Lever [Mon, 14 Nov 2005 16:50:57 +0000 (11:50 -0500)]
use "crt_series.get_branch()" instead of "git.get_head_file()"

More cleanup to the branch command.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoBetter error message when renaming patches to same name
Chuck Lever [Mon, 14 Nov 2005 16:50:55 +0000 (11:50 -0500)]
Better error message when renaming patches to same name

Generate a more precise error message when trying to rename a patch to the
same name.  This is what we get currently:

  [cel@dexter main]$ stg rename nfs_direct_wait nfs_direct_wait
  Renaming patch "nfs_direct_wait" -> "nfs_direct_wait"...stg rename: Patch
  "nfs_direct_wait" already exists

  [cel@dexter main]$

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoFix the --name option for the pick command
Catalin Marinas [Fri, 11 Nov 2005 10:12:46 +0000 (10:12 +0000)]
Fix the --name option for the pick command

If a patch name from a different branch is given, the --name option is
ignored.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoOptimise pick --fold to use git-apply first
Catalin Marinas [Thu, 10 Nov 2005 14:28:42 +0000 (14:28 +0000)]
Optimise pick --fold to use git-apply first

If "git-diff-tree | git-apply" fails, the command falls back to a
three-way merge.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoDifferent fixes for the branch command
Catalin Marinas [Wed, 9 Nov 2005 21:57:38 +0000 (21:57 +0000)]
Different fixes for the branch command

Mainly checks for local changes were added and some typos.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoGeneralize branch renaming
Chuck Lever [Sat, 5 Nov 2005 22:47:06 +0000 (17:47 -0500)]
Generalize branch renaming

The Series object already has the path names of all the pieces we need to
rename, so let's reuse that information.  Extract the rename branch logic
from the "stg branch" command and put it in stack.py.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd a stack method for determining whether a branch is initialised
Chuck Lever [Wed, 2 Nov 2005 21:55:46 +0000 (16:55 -0500)]
Add a stack method for determining whether a branch is initialised

Let's be consistent about how we decide whether a branch is ready for use
by stgit.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoReplace a variable that uses the same name as a built-in
Chuck Lever [Wed, 2 Nov 2005 21:55:42 +0000 (16:55 -0500)]
Replace a variable that uses the same name as a built-in

Maintainability: "str" hides the name of a Python built-in function
(found by pychecker).

I've also replaced the use of the variable "string" throughout, as it
hides the name of the Python 'string' module.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoFix up help string for "stg clone"
Chuck Lever [Wed, 2 Nov 2005 21:55:39 +0000 (16:55 -0500)]
Fix up help string for "stg clone"

The help string for "stg clone" is the same as the one for "stg pull".

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years ago"stg export" error message could be more specific
Chuck Lever [Wed, 2 Nov 2005 21:55:37 +0000 (16:55 -0500)]
"stg export" error message could be more specific

Like similar previous patches, make "stg export" distinguish between an
unapplied patch and a non-existent one when reporting a failure.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoremove extra refresh_index() call in apply_patches()
Chuck Lever [Wed, 2 Nov 2005 21:55:35 +0000 (16:55 -0500)]
remove extra refresh_index() call in apply_patches()

apply_patches() calles git.merge() and git.switch(), both of which already
invoke refresh_index().

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd a space after ',' when building the e-mail recipients headers
Catalin Marinas [Fri, 4 Nov 2005 17:33:50 +0000 (17:33 +0000)]
Add a space after ',' when building the e-mail recipients headers

This patch also untabifies the mail.py file.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoOptimise the export command
Catalin Marinas [Fri, 4 Nov 2005 16:05:09 +0000 (16:05 +0000)]
Optimise the export command

This patch replaces the call to git_id with patch.get_(top|bottom).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoAdd a patches command
Catalin Marinas [Fri, 4 Nov 2005 16:05:06 +0000 (16:05 +0000)]
Add a patches command

This command shows the patches that modify a given file.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoFix the 'files' initialisation in git.checkout()
Catalin Marinas [Fri, 4 Nov 2005 10:27:22 +0000 (10:27 +0000)]
Fix the 'files' initialisation in git.checkout()

The 'files' variable should have been initialised to an empty list, not
None. Thanks to Kai Ruemmler for spotting it.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoUsing a mutable default function argument is bad
Chuck Lever [Wed, 26 Oct 2005 18:51:54 +0000 (14:51 -0400)]
Using a mutable default function argument is bad

Python function arguments can have default values.  These values are
objects that are created when the "def" statement is run, not when the
function is called.  These objects are thus persistent across calls to
that function.  If a mutable object, such as a list, is used as a
default argument, that object will retain its value across function
calls.  This is potentially unwanted behavior if the function is called
multiple times.

Fix up function argument defaults in stgit/git.py, for safety.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd an option to delete a patch from a certain branch
Paolo \'Blaisorblade\' Giarrusso [Mon, 31 Oct 2005 20:54:47 +0000 (21:54 +0100)]
Add an option to delete a patch from a certain branch

From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Actually, simply adding the option is enough...
Restrict print_crt_patch() to the case when we didn't specify --branch (as it's
useless otherwise).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
18 years agoCapture the KeyboardInterrupt exception
Catalin Marinas [Thu, 27 Oct 2005 19:47:25 +0000 (20:47 +0100)]
Capture the KeyboardInterrupt exception

This is to avoid a stack back-trace when a command is interrupted by the
user.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoNotify when a cherry-picked commit was modified by 'pick'
Catalin Marinas [Thu, 27 Oct 2005 19:47:24 +0000 (20:47 +0100)]
Notify when a cherry-picked commit was modified by 'pick'

The logic is similar to the 'push' command one (i.e. it is reported as
modified if a three-way merge is needed).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoNotify when a patch was modified during a push operation
Catalin Marinas [Thu, 27 Oct 2005 19:47:24 +0000 (20:47 +0100)]
Notify when a patch was modified during a push operation

The logic of this is that when a "git-diff | git-apply" succeeds, the patch
is reported as unmodified. If the the above operation fails and the command
falls back to a three-way merge, the patch will be reported as modified.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoUse __run instead of os.system() in git.merge()
Chuck Lever [Wed, 26 Oct 2005 18:52:00 +0000 (14:52 -0400)]
Use __run instead of os.system() in git.merge()

This is just a little faster, avoiding an unneeded invocation of the shell.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoPrevent stderr from appearing on stdout when running commands
Chuck Lever [Wed, 26 Oct 2005 18:51:58 +0000 (14:51 -0400)]
Prevent stderr from appearing on stdout when running commands

The original purpose was to eliminate "fatal: Needed single revision" when
a ref didn't exist, but this seems like an overall good thing to do to help
with output cleanliness..

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoNeed to do "git-update-index --refresh" in more places
Chuck Lever [Wed, 26 Oct 2005 18:51:56 +0000 (14:51 -0400)]
Need to do "git-update-index --refresh" in more places

Recent changes to the git porcelain-ish shell scripts added
"git-update-index --refresh" in several places.  This harmlessly allows
a dirty tree during certain operations that use git-read-tree.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoPrint the git version when running the "stg version" command
Chuck Lever [Wed, 26 Oct 2005 18:51:51 +0000 (14:51 -0400)]
Print the git version when running the "stg version" command

"git --version" was added only recently.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years ago"stg mail" doesn't distinguish between unapplied and non-existent patches
Chuck Lever [Wed, 26 Oct 2005 18:51:49 +0000 (14:51 -0400)]
"stg mail" doesn't distinguish between unapplied and non-existent patches

Same fix as the recent fixes to "pop" and "push".

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoMake listing branches more efficient
Chuck Lever [Wed, 26 Oct 2005 18:51:47 +0000 (14:51 -0400)]
Make listing branches more efficient

Listing branches appears to "init" the series twice for each branch in
the list.  Similarly for deleting a branch.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoMake switching to the current branch a no-op
Chuck Lever [Wed, 26 Oct 2005 18:51:45 +0000 (14:51 -0400)]
Make switching to the current branch a no-op

Check if "stg branch name" is switching to the branch we are already in,
and make that case a no-op.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoFix exception error message in git.merge()
Chuck Lever [Wed, 26 Oct 2005 18:51:43 +0000 (14:51 -0400)]
Fix exception error message in git.merge()

Due to recent big git script rename.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoGet rid of an unused variable
Chuck Lever [Wed, 26 Oct 2005 18:51:41 +0000 (14:51 -0400)]
Get rid of an unused variable

"git_opt" is unused in the rm() function.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoMake sure switch_branch uses the right __head
Chuck Lever [Wed, 26 Oct 2005 18:51:38 +0000 (14:51 -0400)]
Make sure switch_branch uses the right __head

"switch_branch" needs to use the global variable __head, not a local
version.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoRemove unused import in stgit/git.py
Chuck Lever [Wed, 26 Oct 2005 18:51:34 +0000 (14:51 -0400)]
Remove unused import in stgit/git.py

The "glob" module isn't used in stgit/git.py, so don't import it.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoGive the global "crt_series" variable a default value
Chuck Lever [Wed, 26 Oct 2005 18:51:32 +0000 (14:51 -0400)]
Give the global "crt_series" variable a default value

The Python interpreter was searching every scope to find crt_series.  By
providing a default value, this reduces the amount of searching the
interpreter does looking for crt_series.

I've noticed that most commands are faster with this change.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAsk vim to avoid backup copies of .stgit.msg
Paolo \'Blaisorblade\' Giarrusso [Thu, 27 Oct 2005 08:56:34 +0000 (10:56 +0200)]
Ask vim to avoid backup copies of .stgit.msg

From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Do this by adding nobackup to the modeline.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
18 years agoParse /top.old with id and when requesting diffs
Paolo \'Blaisorblade\' Giarrusso [Thu, 27 Oct 2005 08:56:22 +0000 (10:56 +0200)]
Parse /top.old with id and when requesting diffs

From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

Comparing a patch after and before a merge is very important, and looking into
.git/patches by hand is not the nicer way to do it.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
18 years agoAllow the editing of the cover message before sending it by e-mail
Catalin Marinas [Fri, 21 Oct 2005 13:25:23 +0000 (14:25 +0100)]
Allow the editing of the cover message before sending it by e-mail

When sending e-mails, it is easier to automatically invoke the editor on
the cover message than writing it separately. This patch renames the
--first option to --cover and allows a --edit option to edit the final
message before sending it. With --edit only, the tool will use the default
template in .git/covermail.tmpl or
/usr/share/stgit/templates/covermail.tmpl.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoFix the branch protect/unprotect message
Catalin Marinas [Mon, 17 Oct 2005 14:50:19 +0000 (15:50 +0100)]
Fix the branch protect/unprotect message

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoFlush the HEAD cache in set_head_file()
Catalin Marinas [Fri, 7 Oct 2005 21:15:38 +0000 (22:15 +0100)]
Flush the HEAD cache in set_head_file()

This function also changes the value read from the HEAD link but it didn't
flush the internal cached value.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoFix a bug in "stg branch --rename"
Chuck Lever [Thu, 6 Oct 2005 20:59:55 +0000 (21:59 +0100)]
Fix a bug in "stg branch --rename"

We were using the wrong pathname when setting HEAD.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years ago[PATCH] Fix a couple of bugs in "stg branch --create"
Chuck Lever [Thu, 6 Oct 2005 20:58:01 +0000 (21:58 +0100)]
[PATCH] Fix a couple of bugs in "stg branch --create"

Use "switch()" instead of "git.switch()".  Also, __set_head is a little
more complicated now, so a __clear_head_cache() is needed before we call it.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd support for branch description files
Chuck Lever [Thu, 6 Oct 2005 12:57:40 +0000 (13:57 +0100)]
Add support for branch description files

These are single line files that are displayed by "stg branch --list".

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAllow user to protect some branches against "stg pull"
Chuck Lever [Thu, 6 Oct 2005 12:57:12 +0000 (13:57 +0100)]
Allow user to protect some branches against "stg pull"

Sometimes we want to develop against a branch that doesn't evolve (eg.
2.6.12).  To prevent an accidental "stg pull", provide two new options to
stg: "--protect" and "--unprotect".  This also prevents deleting any
patches in the series.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoRudimentary support for multiple development branches
Chuck Lever [Thu, 6 Oct 2005 12:56:42 +0000 (13:56 +0100)]
Rudimentary support for multiple development branches

 stg branch

   show the name of the current branch.

 stg branch <branch-name>

   switch to the named branch.  after the switch is complete,
   all currently applied patches in the target branch are
   applied.

 stg branch --create <branch-name> [ <commit-sha1> ]

   create a new branch.  if <commit-sha1> is not specified then
   the branch is created starting at the commit pointed to by
   the current HEAD.  otherwise, the branch is created starting
   at the given commit.

   when the branch creation completes, the new branch becomes
   the current branch.

 stg branch --delete [ <branch-name> ]

   delete a branch and all patches it contains.  if no name is
   specified, delete the current branch and switch to the
   "master" branch.  otherwise, delete the named branch.

 stg branch --list

   list all the development branches in the current repository
   along with their descriptions and status.

 stg branch --rename <from-branch-name> <to-branch-name>

   rename a branch, and switch to the new name.

 stg branch -h

   print a synopsis of the "stg branch" command.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAllow print_crt_patch to work on other branches
Chuck Lever [Thu, 6 Oct 2005 10:20:14 +0000 (11:20 +0100)]
Allow print_crt_patch to work on other branches

print_crt_patch() current prints the current patch in the current branch.
Add a function argument to allow it to print the current patch in other
branches.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd the ability to rename a git branch
Chuck Lever [Thu, 6 Oct 2005 10:19:22 +0000 (11:19 +0100)]
Add the ability to rename a git branch

To keep StGit-specific functionality separate from git functionality,
create a git.rename_branch function to do appropriate sanity checking and
rename branch heads.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd the ability to delete a branch to git.py
Chuck Lever [Thu, 6 Oct 2005 10:18:18 +0000 (11:18 +0100)]
Add the ability to delete a branch to git.py

"git branch -D" checks first to see whether all the commits in the doomed
branch are already in the branch pointed to by HEAD.  I don't think we need
that level of checking here.  We just delete "refs/heads/branchname."

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd git method for switching to a different branch
Chuck Lever [Thu, 6 Oct 2005 10:17:50 +0000 (11:17 +0100)]
Add git method for switching to a different branch

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd git method for creating a fresh branch
Chuck Lever [Thu, 6 Oct 2005 10:17:48 +0000 (11:17 +0100)]
Add git method for creating a fresh branch

Basically this is "git checkout -b".

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoCreate a new utility function in git.py for setting the HEAD link
Chuck Lever [Thu, 6 Oct 2005 10:12:44 +0000 (11:12 +0100)]
Create a new utility function in git.py for setting the HEAD link

Add a new method in git.py for switching the HEAD link to point to a
different ref.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAdd a stack method to delete a patch series
Chuck Lever [Thu, 6 Oct 2005 10:12:06 +0000 (11:12 +0100)]
Add a stack method to delete a patch series

In preparation to introducing the ability to delete a branch, add a stack
method that will iterate over a patch series and delete each patch.

Signed-off-by: Chuck Lever <cel@netapp.com>
18 years agoAllow the short version of --base (i.e. -b) in import
Catalin Marinas [Thu, 6 Oct 2005 10:07:08 +0000 (11:07 +0100)]
Allow the short version of --base (i.e. -b) in import

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoUse git_id in import and fold instead of git.rev_parse
Catalin Marinas [Thu, 6 Oct 2005 09:57:17 +0000 (10:57 +0100)]
Use git_id in import and fold instead of git.rev_parse

git_id() is more flexible since it knows about StGIT patches.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoFix the caching of the HEAD value
Catalin Marinas [Thu, 6 Oct 2005 09:52:52 +0000 (10:52 +0100)]
Fix the caching of the HEAD value

'git pull' also updates the HEAD but StGIT did not flush the cached value
causing problems with pulling.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoAdd a --reset option to resolved
Catalin Marinas [Wed, 5 Oct 2005 15:58:18 +0000 (16:58 +0100)]
Add a --reset option to resolved

With this option one can ask for a conflicted file to be reset to one of
the local, remote or older states.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoAllow git.apply_patch() to take a base revision
Catalin Marinas [Wed, 5 Oct 2005 15:58:18 +0000 (16:58 +0100)]
Allow git.apply_patch() to take a base revision

This option is useful for import --base and fold commands. Both these
commands were modified to take advantage of it. The fold commands also
supports a --base option, similar to the import one.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoAdd a --fold option to pick
Catalin Marinas [Wed, 5 Oct 2005 15:58:18 +0000 (16:58 +0100)]
Add a --fold option to pick

This option causes the given commit object to be merged into the current
patch instead of creating a new one.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoTODO updated with the need for a 'prune' command
Catalin Marinas [Wed, 5 Oct 2005 15:58:10 +0000 (16:58 +0100)]
TODO updated with the need for a 'prune' command

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years ago'status --reset' should remove the conflicts as well
Catalin Marinas [Wed, 5 Oct 2005 08:32:08 +0000 (09:32 +0100)]
'status --reset' should remove the conflicts as well

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
18 years agoAdd the --reset option to status
Catalin Marinas [Tue, 4 Oct 2005 19:56:18 +0000 (20:56 +0100)]
Add the --reset option to status

This option resets all the changes in the current tree (relative to HEAD).

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