* Re: [PATCH] git-push: add a --delete flag to allow branch deletion
From: Andreas Ericsson @ 2008-06-19 22:30 UTC (permalink / raw)
To: Pieter de Bie; +Cc: Git Mailinglist, Junio C Hamano
In-Reply-To: <1213884787-24692-1-git-send-email-pdebie@ai.rug.nl>
Pieter de Bie wrote:
> While this is already possible with the :<dst> refspec syntax,
> a flag specifically for this action is more userfriendly.
>
I like it. I always have to tell my co-workers which side of
the colon the branch-name to delete should be on. Since they
want the remote to lose the branch, it seems logical to some
of them to make that side empty. This would make one (very
small) headache of mine go away.
Question though; does it delete the currently checked out
branch if no branch-name is given? I'd prefer if one has
to explicitly name the branch to delete.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply
* Re: [PATCH v2] gitweb: standarize HTTP status codes
From: Jakub Narebski @ 2008-06-19 22:22 UTC (permalink / raw)
To: Lea Wiemann; +Cc: git
In-Reply-To: <485AAEB9.2080100@gmail.com>
Lea Wiemann wrote:
> Jakub Narebski wrote:
>> Lea Wiemann <lewiemann@gmail.com> writes:
>>>
>>> For convenience the die_error function now only takes the status code
>>> without reason as first parameter (e.g. 404 instead of "404 Not Found")
>>
>> _Whose_ convenience?
>
> The developer's convenience of course. It's plain redundant.
Redundancy isn't always bad.
Moreover I think that "convenience of developer" here is a bit matter
of taste, and the fact if one is web developer, or "accidental" gitweb
developer.
>> * I don't think that RFC 2616 allows blanket replacing reason phrase
>> by generic "Error",
>> * Test::WWW::Mechanize displays both HTTP error status code and
>> reason phrase when get_ok(...) fails:
>> * From the point of view of someone examinimg gitweb.perl code, 400,
>> 403, 404, 500 are _magic numbers_;
>
> I think we're really arguing about the color of the bikeshed here. IMO
> we're not stretching RFC 2616 too much by putting "Error" there (since
> reason codes don't matter on a technical level), and the status codes
> make enough sense to me (and I'm not even a web developer) that I'm not
> concerned about readability.
Well, I didn't know what 400 code meant, and I had to check RFC 2616
for that. '400 Bad Request' is more readable.
But it is a bit bikeshedding. This patch consist of two things: using
better HTTP error status codes (for example getting rid of
403 Forbidden as default catch-all code and using 500 Internal Server
Error for cases where an error _is_ serious server error), and
changing die_error(...) signature / calling convention (meant for
convenience). I agree wholeheartly with first part (modulo using
404 Not Found for errors which usually happens because of user error).
Second part might wait when code stabilizes and there is lull in the
gitweb development (changes shouldn't conflict anyway, but applying
patches might fail because of changed context)...
...but as I can see you have send PATCH v3, in the form I can agree
with.
> I don't think your constants a la HTTP_INVALID are a good idea (I
> remember the status codes in a year, but maybe not the constants);
I can agree with that.
> die_error could figure out the right reason code using a hash. (...)
Good idea. I see it is done this way in PATCH v3.
>>> - die_error(undef, "At least two characters are required for search parameter");
>>> + die_error(403, "At least two characters are required for search parameter");
>>
>> Should gitweb use there '403 Forbidden', or '400 Bad Request'?
>> This is failing static validation of CGI parameters, not a matter of
>> some permissions...
>
> I used 403 in the sense of "sorry, we don't have shorter search strings
> activated for performance reasons". The '2' could even become
> configurable. 400 is fine too, though, I don't care.
I had in mind using '403 Forbidden' for "permission denied" errors,
i.e. for cases where different _configuration_ could result in access.
>>> - close $fd or die_error(undef, "Reading tree failed");
>>> + close $fd or die_error(500, "Reading tree failed");
>>
>> Not O.K. Barring errors in gitweb code this might happen when
>> [X Y Z]. All those are clearly 4xx _client_ errors,
>
> I haven't verified that, so until we have better error handling I prefer
> 500, but I really won't bother objecting to 404.
I'd rather have '404 Not Found' here; in most cases this is client
error, and one should examine URL not mail webmaster.
> FWIW I'm
> assuming that once gitweb uses the new API, that error handling code
> will go away anyway.
I hope that performance impact for non-caching case would be negligible,
and cleaner code would overweigth this concern.
>>> if (!defined $ftype) {
>>> - die_error(undef, "Unknown type of object");
>>> + die_error(500, "Unknown type of object");
>>
>> Errr... shouldn't be '400 Bad Request' here, per convention?
>
> Nope, we didn't get *anything* back, so something weird happened. 500.
Ohhh... right. I didn't get that from seeing only this part.
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [PATCH] git-apply doesn't handle same name patches well [V3]
From: Junio C Hamano @ 2008-06-19 22:15 UTC (permalink / raw)
To: Don Zickus; +Cc: git
In-Reply-To: <20080619213341.GP16941@redhat.com>
Don Zickus <dzickus@redhat.com> writes:
> On Tue, Jun 17, 2008 at 05:42:54PM -0700, Junio C Hamano wrote:
>> Don Zickus <dzickus@redhat.com> writes:
> ...
> I was going to try to figure out a way to grab it from fn_cache but I
> wasn't sure how much of the 'lstat' info is needed later.
The usual case of one-diff-one-path patch application wants to make sure
that there is no discrepancy between the index and the work tree for the
path when working in --index mode. When working in work-tree-only mode,
lstat just makes sure that the path to be patched actually exists (or
doesn't, if it is a creation patch).
When fn_cache is used, you pretend as if the resulting path exists and up
to date when found in fn_cache and the previous round succeeded, so you
can substitute the lstat (you cannot just lose it, but need to make sure
the path exists after applying the earlier fn_cache contents when handling
a later patch that wants to touch an existing file). As you pretend that
the previous round succeeded, you do not have to check the up-to-dateness
between the index and work tree when dealing with a path that has previous
result in fn_cache, even when operating in --index mode.
>> or do you mean that the first patch rename-edits A to B, but the second
>> one still wants to edit A in place and you would want to pretend as if the
>> later one is for a patch to B? I would think that is doable but asking
>> for too much magic, and a tool with too much magic is scary.
>
> Personally I think this case should be a failure. I even attached a
> testcase in my patch to make sure this failed. I wasn't comfortable doing
> this magic either.
Good.
>> There is a case where a normal git patch contains two separate patches to
>> the same file. A typechange patch is always expressed as a deletion of
>> the old path immediately followed by a creation of the same path. I have
>> to wonder why that codepath for handing that particular special case is
>> not changed in this patch. Surely the mechanism you are adding is a
>> generalization that can cover such a case as well, isn't it?
>
> Heh. Maybe, but I didn't know the code well enough to do that. Pointers?
See the way "prev_patch" is used in check_patch.
>> > @@ -2176,6 +2184,38 @@ static int read_file_or_gitlink(struct cache_entry *ce, struct strbuf *buf)
>> > return 0;
>> > }
>> >
>> > +struct patch *in_fn_cache(char *name)
>> > +{
>> > + struct path_list_item *item;
>> > +
>> > + item = path_list_lookup(name, &fn_cache);
>> > + if (item != NULL)
>> > + return (struct patch *)item->util;
>> > +
>> > + return NULL;
>> > +}
>> > +
>> > +void add_to_fn_cache(char *name, struct patch *patch)
>> > +{
>> > + struct path_list_item *item;
>> > +
>> > + /* Always add new_name unless patch is a deletion */
>> > + if (name != NULL) {
>> > + item = path_list_insert(name, &fn_cache);
>> > + item->util = patch;
>> > + }
>> > +
>> > + /* skip normal diffs, creations and copies */
>>
>> This comment is a "Huh?".
> I was just making a note about which cases I wanted to skip and which ones
> I wanted to process. I can expand on it. For example, patches that
> contain normal diffs, file creations and git copies or ignored as don't
> cares. Only file deletions and git renames were interesting to me in the
> code below.
The function's purpose is to record what the expected state of the path
after the current patch has applied successfully, and
* If it is not a deletion, you will record the postimage, so that a later
patch can work from there, not from what is in the initial state;
* If it is a deletion (or rename-away), you record that the path after
this patch no longer exists, so that you can catch a later broken patch
that tries to touch the path.
You have already handled "normal diff, creation and copy" in the first
part "if (name != NULL)", but you talk about it again here, which was the
"Huh?" inducing part. It gave an impression that the part that follows
does something other than the above two.
>> > + /*
>> > + * store a failure on rename/deletion cases because
>> > + * later chunks shouldn't patch old names
>> > + */
>> > + if ((name == NULL) || (patch->is_rename)) {
>> > + item = path_list_insert(patch->old_name, &fn_cache);
>> > + item->util = (struct patch *) -1;
If you have a patch that does A->B (rename), C->A (rename), A->A (mod),
would your code handle that?
>> If you look at the patch->old_name _anyway_, why do you give a separate
>> name parameter to this function? The function would be much easier to
>> read if you pass only patch, and use patch->new_name instead of the
>> separate name parameter. Otherwise the reader needs to scroll down and
>> figure out that name is a new name by looking at the call site to
>> understand what is going on.
>
> Yeah, leftover code that was added when I ran into rename and copy
> problems.
>
>>
>> > + }
>> > +}
>> > +
>> > static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *ce)
>> > {
>> > struct strbuf buf;
>> > @@ -2188,7 +2228,16 @@ static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
>> > if (read_file_or_gitlink(ce, &buf))
>> > return error("read of %s failed", patch->old_name);
>> > } else if (patch->old_name) {
>> > - if (S_ISGITLINK(patch->old_mode)) {
>> > + struct patch *tpatch = in_fn_cache(patch->old_name);
>> > +
>> > + if (tpatch != NULL) {
>> > + if (tpatch == (struct patch *) -1) {
>> > + return error("patch %s has been renamed/deleted",
>> > + patch->old_name);
>> > + }
>> > + /* We have a patched copy in memory use that */
>> > + strbuf_add(&buf, tpatch->result, tpatch->resultsize);
>> > + } else if (S_ISGITLINK(patch->old_mode)) {
>>
>> Isn't this wrong? Why can't this new enhancement be used while operating
>> only on the index?
>
> I don't know, can it? You tell me. I wasn't sure on the whole index
> thing worked.
Perhaps a "git-apply" primer might help. The program can work in three
modes of operation.
* normal mode: look at and operate only on work tree files.
* --index mode: work on both the index and the work tree. IOW, patch the
files and immediately do "git add -u" on that path, so that even
addition and deletion are recorded in the index. In this case, the
paths involved must be up-to-date between the work tree and the index
when you start "git apply"; otherwise you will lose your local
changes.
* --cached mode: work only on the index and never look at nor touch the
work tree.
Now, if you have a patch that has A->A (mod), followed by another A->A(mod),
is there a good reason why you allow it in the first two modes and not the
last one? I do not think so.
^ permalink raw reply
* Re: name-rev --stdin is slow
From: Lea Wiemann @ 2008-06-19 22:09 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: Git Mailing List
In-Reply-To: <alpine.LNX.1.00.0806191755510.19665@iabervon.org>
Daniel Barkalow wrote:
> Actually, I think it's the reverse: without --stdin, name-rev can do a
> first pass that lets it eliminate a lot of data from consideration; with
> --stdin, it doesn't know if an item it hasn't seen is going to need some
> data, and so it's conservative and doesn't eliminate anything,
Are you sure that's the case? time git-name-rev --stdin < /dev/null
gives the same high startup time without looking up anything.
Anyways, it would be great if someone could try to fix that, since a
6-second startup time on a repository like linux-2.6 makes the --stdin
option unusable for applications like gitweb (for which it would
actually be quite useful to reduce the number of forks).
-- Lea
^ permalink raw reply
* Re: name-rev --stdin is slow
From: Daniel Barkalow @ 2008-06-19 22:03 UTC (permalink / raw)
To: Lea Wiemann; +Cc: Git Mailing List
In-Reply-To: <485ACB34.2020901@gmail.com>
On Thu, 19 Jun 2008, Lea Wiemann wrote:
> name-rev --stdin has some really high start-up time. The example below is on
> my git.git branch. Is this unavoidable to make name-rev fast for naming high
> numbers of revisions -- i.e. is it about amortization? Still, 0.7 seconds
> seems pretty excessive, and on linux-2.6 it even takes 6 seconds.
>
> Anyone care to look into it?
Actually, I think it's the reverse: without --stdin, name-rev can do a
first pass that lets it eliminate a lot of data from consideration; with
--stdin, it doesn't know if an item it hasn't seen is going to need some
data, and so it's conservative and doesn't eliminate anything, which means
that each request is slower, at least until it's cached everything that
you turn out to care about.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* Re: [PATCH] completion: add --graph to log command completion
From: Shawn O. Pearce @ 2008-06-19 21:58 UTC (permalink / raw)
To: Dan McGee; +Cc: git
In-Reply-To: <1213910153-10679-1-git-send-email-dpmcgee@gmail.com>
Dan McGee <dpmcgee@gmail.com> wrote:
> Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
First change for 1.5.6.1? With --graph in 1.5.6 we really should
have included this as part of 1.5.6. Oh well. 1.5.6.1 perhaps
Junio?
> ---
> contrib/completion/git-completion.bash | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 2141b6b..0eb8df0 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -761,6 +761,7 @@ _git_log ()
> --pretty= --name-status --name-only --raw
> --not --all
> --left-right --cherry-pick
> + --graph
> "
> return
> ;;
> --
> 1.5.6
--
Shawn.
^ permalink raw reply
* Re: Including branch info in git format-patch
From: Mukund Sivaraman @ 2008-06-19 21:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, git
In-Reply-To: <7vod5xrtjx.fsf@gitster.siamese.dyndns.org>
On Thu, Jun 19, 2008 at 02:41:54PM -0700, Junio C Hamano wrote:
> > My problem is that I can't send a patch out to the list for other
> > developers to try, without some annotation for them, of which branch to
> > try it on.
>
> So what's wrong telling that when you send out the patch, between the time
> you run format-patch and send-email?
>
I had asked if there was some way the remote branch name could
automatically be inserted by git format-patch, instead of manually adding
it in the patch message or in a cover letter. What Jeff suggested seems
good to me (of using --subject-prefix) as that is removed automatically
when the patch is applied by git am.
Mukund
^ permalink raw reply
* [StGIT PATCH 4/4] Remove the applied/unapplied commands
From: Catalin Marinas @ 2008-06-19 21:42 UTC (permalink / raw)
To: git, Karl Hasselström
In-Reply-To: <20080619214023.27794.97039.stgit@localhost.localdomain>
This patch moves the applied/unapplied functionality to the 'series'
command via the corresponding options.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/applied.py | 51 -------------------------------------------
stgit/commands/series.py | 13 +++++++++--
stgit/commands/unapplied.py | 50 ------------------------------------------
stgit/main.py | 4 ---
t/t1002-branch-clone.sh | 6 +++--
t/t1003-new.sh | 4 ++-
t/t1200-push-modified.sh | 12 +++++-----
t/t1203-pop.sh | 12 +++++-----
t/t1204-pop-keep.sh | 12 +++++-----
t/t1205-push-subdir.sh | 4 ++-
t/t1301-repair.sh | 12 +++++-----
t/t1302-repair-interop.sh | 20 ++++++++---------
t/t1500-float.sh | 14 ++++++------
t/t1600-delete-one.sh | 28 ++++++++++++------------
t/t1601-delete-many.sh | 24 ++++++++++----------
t/t2000-sync.sh | 48 ++++++++++++++++++++--------------------
t/t2200-rebase.sh | 4 ++-
t/t2500-clean.sh | 12 +++++-----
t/t2600-coalesce.sh | 12 +++++-----
t/t3000-dirty-merge.sh | 8 +++----
t/t4000-upgrade.sh | 4 ++-
21 files changed, 129 insertions(+), 225 deletions(-)
delete mode 100644 stgit/commands/applied.py
delete mode 100644 stgit/commands/unapplied.py
diff --git a/stgit/commands/applied.py b/stgit/commands/applied.py
deleted file mode 100644
index e57c796..0000000
--- a/stgit/commands/applied.py
+++ /dev/null
@@ -1,51 +0,0 @@
-
-__copyright__ = """
-Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 as
-published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""
-
-from optparse import make_option
-from stgit.out import *
-from stgit.commands import common
-
-
-help = 'print the applied patches'
-usage = """%prog [options]
-
-List the patches from the series which have already been pushed onto
-the stack. They are listed in the order in which they were pushed, the
-last one being the current (topmost) patch."""
-
-directory = common.DirectoryHasRepositoryLib()
-options = [make_option('-b', '--branch',
- help = 'use BRANCH instead of the default branch'),
- make_option('-c', '--count',
- help = 'print the number of applied patches',
- action = 'store_true')]
-
-
-def func(parser, options, args):
- """Show the applied patches
- """
- if len(args) != 0:
- parser.error('incorrect number of arguments')
-
- s = directory.repository.get_stack(options.branch)
-
- if options.count:
- out.stdout(len(s.patchorder.applied))
- else:
- for pn in s.patchorder.applied:
- out.stdout(pn)
diff --git a/stgit/commands/series.py b/stgit/commands/series.py
index c11c74f..24d6ffa 100644
--- a/stgit/commands/series.py
+++ b/stgit/commands/series.py
@@ -37,6 +37,12 @@ options = [make_option('-b', '--branch',
make_option('-a', '--all',
help = 'show all patches, including the hidden ones',
action = 'store_true'),
+ make_option('--applied',
+ help = 'show the applied patches only',
+ action = 'store_true'),
+ make_option('--unapplied',
+ help = 'show the unapplied patches only',
+ action = 'store_true'),
make_option('--hidden',
help = 'show the hidden patches only',
action = 'store_true'),
@@ -112,17 +118,20 @@ def func(parser, options, args):
stack = directory.repository.get_stack(options.missing)
# current series patches
+ applied = unapplied = hidden = ()
if options.all:
applied = stack.patchorder.applied
unapplied = stack.patchorder.unapplied
hidden = stack.patchorder.hidden
+ elif options.applied:
+ applied = stack.patchorder.applied
+ elif options.unapplied:
+ unapplied = stack.patchorder.unapplied
elif options.hidden:
- applied = unapplied = ()
hidden = stack.patchorder.hidden
else:
applied = stack.patchorder.applied
unapplied = stack.patchorder.unapplied
- hidden = ()
if options.missing:
cmp_patches = cmp_stack.patchorder.all
diff --git a/stgit/commands/unapplied.py b/stgit/commands/unapplied.py
deleted file mode 100644
index 7323346..0000000
--- a/stgit/commands/unapplied.py
+++ /dev/null
@@ -1,50 +0,0 @@
-
-__copyright__ = """
-Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 2 as
-published by the Free Software Foundation.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""
-
-from optparse import make_option
-from stgit.out import *
-from stgit.commands import common
-
-
-help = 'print the unapplied patches'
-usage = """%prog [options]
-
-List the patches from the series which are not pushed onto the stack.
-They are listed in the reverse order in which they were popped."""
-
-directory = common.DirectoryHasRepositoryLib()
-options = [make_option('-b', '--branch',
- help = 'use BRANCH instead of the default branch'),
- make_option('-c', '--count',
- help = 'print the number of unapplied patches',
- action = 'store_true')]
-
-
-def func(parser, options, args):
- """Show the unapplied patches
- """
- if len(args) != 0:
- parser.error('incorrect number of arguments')
-
- s = directory.repository.get_stack(options.branch)
-
- if options.count:
- out.stdout(len(s.patchorder.unapplied))
- else:
- for pn in s.patchorder.unapplied:
- out.stdout(pn)
diff --git a/stgit/main.py b/stgit/main.py
index aa1f8ef..7be8e14 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -59,7 +59,6 @@ class Commands(dict):
return getattr(stgit.commands, cmd_mod)
commands = Commands({
- 'applied': 'applied',
'branch': 'branch',
'delete': 'delete',
'diff': 'diff',
@@ -96,7 +95,6 @@ commands = Commands({
'status': 'status',
'sync': 'sync',
'top': 'top',
- 'unapplied': 'unapplied',
'uncommit': 'uncommit',
'unhide': 'unhide'
})
@@ -107,7 +105,6 @@ repocommands = (
'id',
)
stackcommands = (
- 'applied',
'branch',
'clean',
'coalesce',
@@ -125,7 +122,6 @@ stackcommands = (
'series',
'sink',
'top',
- 'unapplied',
'uncommit',
'unhide',
)
diff --git a/t/t1002-branch-clone.sh b/t/t1002-branch-clone.sh
index b0087e9..7f3f913 100755
--- a/t/t1002-branch-clone.sh
+++ b/t/t1002-branch-clone.sh
@@ -29,16 +29,16 @@ test_expect_success \
'
stg branch --clone foo &&
stg new p1 -m "p1" &&
- test $(stg applied -c) -eq 1
+ test $(stg series --applied -c) -eq 1
'
test_expect_success \
'Clone the current StGIT branch' \
'
stg branch --clone bar &&
- test $(stg applied -c) -eq 1 &&
+ test $(stg series --applied -c) -eq 1 &&
stg new p2 -m "p2" &&
- test $(stg applied -c) -eq 2
+ test $(stg series --applied -c) -eq 2
'
test_done
diff --git a/t/t1003-new.sh b/t/t1003-new.sh
index 0be5d9b..826e41d 100755
--- a/t/t1003-new.sh
+++ b/t/t1003-new.sh
@@ -17,13 +17,13 @@ test_expect_success \
test_expect_success \
'Create a named patch' '
stg new foo -m foobar &&
- [ $(stg applied -c) -eq 1 ]
+ [ $(stg series --applied -c) -eq 1 ]
'
test_expect_success \
'Create a patch without giving a name' '
stg new -m yo &&
- [ $(stg applied -c) -eq 2 ]
+ [ $(stg series --applied -c) -eq 2 ]
'
test_done
diff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh
index e3c6425..b8ca4cc 100755
--- a/t/t1200-push-modified.sh
+++ b/t/t1200-push-modified.sh
@@ -26,8 +26,8 @@ test_expect_success \
printf "a\nc\n" > file && git add file && stg refresh &&
stg new p2 -m p2 &&
printf "a\nb\nc\n" > file && stg refresh &&
- [ "$(echo $(stg applied))" = "p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
)
'
@@ -57,8 +57,8 @@ test_expect_success \
'Rollback the push' '
(
cd bar && stg push --undo &&
- [ "$(echo $(stg applied))" = "" ] &&
- [ "$(echo $(stg unapplied))" = "p1 p2" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p1 p2" ]
)
'
@@ -66,8 +66,8 @@ test_expect_success \
'Push those patches while checking they were merged upstream' '
(
cd bar && stg push --merged --all
- [ "$(echo $(stg applied))" = "p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
)
'
diff --git a/t/t1203-pop.sh b/t/t1203-pop.sh
index 6e49b4d..e1ed577 100755
--- a/t/t1203-pop.sh
+++ b/t/t1203-pop.sh
@@ -12,22 +12,22 @@ test_expect_success \
for i in 0 1 2 3 4 5 6 7 8 9; do
stg new p$i -m p$i;
done &&
- [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_expect_success \
'Pop half the patches' '
stg pop -n 5 &&
- [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
- [ "$(echo $(stg unapplied))" = "p5 p6 p7 p8 p9" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3 p4" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p6 p7 p8 p9" ]
'
test_expect_success \
'Pop the remaining patches' '
stg pop -a &&
- [ "$(echo $(stg applied))" = "" ] &&
- [ "$(echo $(stg unapplied))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p0 p1 p2 p3 p4 p5 p6 p7 p8 p9" ]
'
test_done
diff --git a/t/t1204-pop-keep.sh b/t/t1204-pop-keep.sh
index 35f4ec0..db473f2 100755
--- a/t/t1204-pop-keep.sh
+++ b/t/t1204-pop-keep.sh
@@ -11,8 +11,8 @@ test_expect_success 'Create a few patches' '
git add patch$i.txt &&
stg refresh
done &&
- [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_expect_success 'Make some non-conflicting local changes' '
@@ -21,8 +21,8 @@ test_expect_success 'Make some non-conflicting local changes' '
test_expect_success 'Pop two patches, keeping local changes' '
stg pop -n 2 --keep &&
- [ "$(echo $(stg applied))" = "p0" ] &&
- [ "$(echo $(stg unapplied))" = "p1 p2" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p0" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p1 p2" ] &&
[ "$(echo $(ls patch?.txt))" = "patch0.txt" ] &&
[ "$(echo $(cat patch0.txt))" = "patch0 local" ]
'
@@ -34,8 +34,8 @@ test_expect_success 'Reset and push patches again' '
test_expect_success 'Pop a patch without local changes' '
stg pop --keep &&
- [ "$(echo $(stg applied))" = "p0 p1" ] &&
- [ "$(echo $(stg unapplied))" = "p2" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
[ "$(echo $(ls patch?.txt))" = "patch0.txt patch1.txt" ]
'
diff --git a/t/t1205-push-subdir.sh b/t/t1205-push-subdir.sh
index 175d36d..27d93da 100755
--- a/t/t1205-push-subdir.sh
+++ b/t/t1205-push-subdir.sh
@@ -12,8 +12,8 @@ test_expect_success 'Create some patches' '
git add x.txt foo/y.txt &&
stg refresh
done &&
- [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_expect_success 'Fast-forward push from a subdir' '
diff --git a/t/t1301-repair.sh b/t/t1301-repair.sh
index b555b93..bf4382e 100755
--- a/t/t1301-repair.sh
+++ b/t/t1301-repair.sh
@@ -37,9 +37,9 @@ test_expect_success \
'
test_expect_success 'Turn one GIT commit into a patch' '
- [ $(stg applied | wc -l) -eq 1 ] &&
+ [ $(stg series --applied -c) -eq 1 ] &&
stg repair &&
- [ $(stg applied | wc -l) -eq 2 ]
+ [ $(stg series --applied -c) -eq 2 ]
'
test_expect_success \
@@ -55,9 +55,9 @@ test_expect_success \
'
test_expect_success 'Turn three GIT commits into patches' '
- [ $(stg applied | wc -l) -eq 2 ] &&
+ [ $(stg series --applied -c) -eq 2 ] &&
stg repair &&
- [ $(stg applied | wc -l) -eq 5 ]
+ [ $(stg series --applied -c) -eq 5 ]
'
test_expect_success \
@@ -72,9 +72,9 @@ test_expect_success \
'
test_expect_success 'Repair in the presence of a merge commit' '
- [ $(stg applied | wc -l) -eq 5 ] &&
+ [ $(stg series --applied -c) -eq 5 ] &&
stg repair &&
- [ $(stg applied | wc -l) -eq 0 ]
+ [ $(stg series --applied -c) -eq 0 ]
'
test_done
diff --git a/t/t1302-repair-interop.sh b/t/t1302-repair-interop.sh
index 82c5ed2..5762111 100755
--- a/t/t1302-repair-interop.sh
+++ b/t/t1302-repair-interop.sh
@@ -21,8 +21,8 @@ test_expect_success 'Create five patches' '
for i in 0 1 2 3 4; do
stg new p$i -m p$i;
done &&
- [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3 p4" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_expect_success 'Pop two patches with git-reset' '
@@ -30,14 +30,14 @@ test_expect_success 'Pop two patches with git-reset' '
! stg refresh &&
stg repair &&
stg refresh &&
- [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "p3 p4" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p3 p4" ]
'
test_expect_success 'Create a new patch' '
stg new q0 -m q0 &&
- [ "$(echo $(stg applied))" = "p0 p1 p2 q0" ] &&
- [ "$(echo $(stg unapplied))" = "p3 p4" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 q0" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p3 p4" ]
'
test_expect_success 'Go to an unapplied patch with with git-reset' '
@@ -45,15 +45,15 @@ test_expect_success 'Go to an unapplied patch with with git-reset' '
! stg refresh &&
stg repair &&
stg refresh &&
- [ "$(echo $(stg applied))" = "p0 p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "q0 p4" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "q0 p4" ]
'
test_expect_success 'Go back to below the stack base with git-reset' '
git reset --hard foo-tag &&
stg repair &&
- [ "$(echo $(stg applied))" = "" ] &&
- [ "$(echo $(stg unapplied))" = "p0 p1 p2 p3 q0 p4" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p0 p1 p2 p3 q0 p4" ]
'
test_done
diff --git a/t/t1500-float.sh b/t/t1500-float.sh
index 778fde4..e44af3a 100755
--- a/t/t1500-float.sh
+++ b/t/t1500-float.sh
@@ -20,37 +20,37 @@ test_expect_success \
stg new F -m "f" && echo F >f.txt && git add f.txt && stg refresh &&
stg new G -m "g" && echo G >g.txt && git add g.txt && stg refresh &&
stg pop &&
- test "$(echo $(stg applied))" = "A B C D E F"
+ test "$(echo $(stg series --applied --noprefix))" = "A B C D E F"
'
test_expect_success \
'Float A to top' \
'stg float A &&
- test "$(echo $(stg applied))" = "B C D E F A"
+ test "$(echo $(stg series --applied --noprefix))" = "B C D E F A"
'
test_expect_success \
'Float A to top (noop)' \
'stg float A &&
- test "$(echo $(stg applied))" = "B C D E F A"
+ test "$(echo $(stg series --applied --noprefix))" = "B C D E F A"
'
test_expect_success \
'Float B C to top' \
'stg float B C &&
- test "$(echo $(stg applied))" = "D E F A B C"
+ test "$(echo $(stg series --applied --noprefix))" = "D E F A B C"
'
test_expect_success \
'Float E A to top' \
'stg float E A &&
- test "$(echo $(stg applied))" = "D F B C E A"
+ test "$(echo $(stg series --applied --noprefix))" = "D F B C E A"
'
test_expect_success \
'Float E to top' \
'stg float E &&
- test "$(echo $(stg applied))" = "D F B C A E"
+ test "$(echo $(stg series --applied --noprefix))" = "D F B C A E"
'
test_expect_success \
'Float G F to top' \
'stg float G F &&
- test "$(echo $(stg applied))" = "D B C A E G F"
+ test "$(echo $(stg series --applied --noprefix))" = "D B C A E G F"
'
test_done
diff --git a/t/t1600-delete-one.sh b/t/t1600-delete-one.sh
index c3451d8..51e4d5b 100755
--- a/t/t1600-delete-one.sh
+++ b/t/t1600-delete-one.sh
@@ -19,27 +19,27 @@ test_expect_success \
test_expect_success \
'Try to delete a non-existing patch' \
'
- [ $(stg applied | wc -l) -eq 1 ] &&
+ [ $(stg series --applied -c) -eq 1 ] &&
! stg delete bar &&
- [ $(stg applied | wc -l) -eq 1 ]
+ [ $(stg series --applied -c) -eq 1 ]
'
test_expect_success \
'Try to delete the topmost patch while dirty' \
'
echo dirty >> foo.txt &&
- [ $(stg applied | wc -l) -eq 1 ] &&
+ [ $(stg series --applied -c) -eq 1 ] &&
! stg delete foo &&
- [ $(stg applied | wc -l) -eq 1 ] &&
+ [ $(stg series --applied -c) -eq 1 ] &&
git reset --hard
'
test_expect_success \
'Delete the topmost patch' \
'
- [ $(stg applied | wc -l) -eq 1 ] &&
+ [ $(stg series --applied -c) -eq 1 ] &&
stg delete foo &&
- [ $(stg applied | wc -l) -eq 0 ]
+ [ $(stg series --applied -c) -eq 0 ]
'
test_expect_success \
@@ -55,9 +55,9 @@ test_expect_success \
test_expect_success \
'Delete an unapplied patch' \
'
- [ $(stg unapplied | wc -l) -eq 1 ] &&
+ [ $(stg series --unapplied -c) -eq 1 ] &&
stg delete foo &&
- [ $(stg unapplied | wc -l) -eq 0 ]
+ [ $(stg series --unapplied -c) -eq 0 ]
'
test_expect_success \
@@ -76,9 +76,9 @@ test_expect_success \
test_expect_success \
'Try to delete a non-topmost applied patch' \
'
- [ $(stg applied | wc -l) -eq 2 ] &&
+ [ $(stg series --applied -c) -eq 2 ] &&
stg delete foo &&
- [ $(stg applied | wc -l) -eq 1 ]
+ [ $(stg series --applied -c) -eq 1 ]
'
test_expect_success \
@@ -99,11 +99,11 @@ test_expect_success \
test_expect_success \
'Delete a patch in another branch' \
'
- [ $(stg applied | wc -l) -eq 2 ] &&
- [ $(stg applied -b br | wc -l) -eq 1 ] &&
+ [ $(stg series --applied -c) -eq 2 ] &&
+ [ $(stg series --applied -b br -c) -eq 1 ] &&
stg delete -b br baz &&
- [ $(stg applied | wc -l) -eq 2 ] &&
- [ $(stg applied -b br | wc -l) -eq 0 ]
+ [ $(stg series --applied -c) -eq 2 ] &&
+ [ $(stg series --applied -b br -c) -eq 0 ]
'
test_done
diff --git a/t/t1601-delete-many.sh b/t/t1601-delete-many.sh
index 30b0a1d..a254980 100755
--- a/t/t1601-delete-many.sh
+++ b/t/t1601-delete-many.sh
@@ -25,31 +25,31 @@ test_expect_success \
test_expect_success \
'Delete some patches' \
'
- [ "$(echo $(stg applied))" = "p0 p1 p2 p3 p4" ] &&
- [ "$(echo $(stg unapplied))" = "p5 p6 p7 p8 p9" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3 p4" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p6 p7 p8 p9" ] &&
stg delete p7 p6 p3 p4 &&
- [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "p5 p8 p9" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ]
'
test_expect_success \
'Delete some more patches, some of which do not exist' \
'
- [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "p5 p8 p9" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ] &&
! stg delete p7 p8 p2 p0 &&
- [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "p5 p8 p9" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ]
'
test_expect_success \
'Delete a range of patches' \
'
- [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "p5 p8 p9" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p5 p8 p9" ] &&
stg delete p1..p8 &&
- [ "$(echo $(stg applied))" = "p0" ] &&
- [ "$(echo $(stg unapplied))" = "p9" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p9" ]
'
test_done
diff --git a/t/t2000-sync.sh b/t/t2000-sync.sh
index 4a00c56..2049c28 100755
--- a/t/t2000-sync.sh
+++ b/t/t2000-sync.sh
@@ -30,8 +30,8 @@ test_expect_success \
stg refresh &&
stg export &&
stg pop &&
- [ "$(echo $(stg applied))" = "p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "p3" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p3" ]
'
test_expect_success \
@@ -41,16 +41,16 @@ test_expect_success \
stg new p1 -m p1 &&
stg new p2 -m p2 &&
stg new p3 -m p3 &&
- [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_expect_success \
'Synchronise second patch with the master branch' \
'
stg sync -B master p2 &&
- [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
test $(cat foo2.txt) = "foo2"
'
@@ -58,8 +58,8 @@ test_expect_success \
'Synchronise the first two patches with the master branch' \
'
stg sync -B master -a &&
- [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
test $(cat foo1.txt) = "foo1" &&
test $(cat foo2.txt) = "foo2"
'
@@ -68,8 +68,8 @@ test_expect_success \
'Synchronise all the patches with the exported series' \
'
stg sync -s patches-master/series -a &&
- [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
test $(cat foo1.txt) = "foo1" &&
test $(cat foo2.txt) = "foo2" &&
test $(cat foo3.txt) = "foo3"
@@ -79,8 +79,8 @@ test_expect_success \
'Modify the master patches' \
'
stg branch master &&
- [ "$(echo $(stg applied))" = "p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "p3" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p3" ] &&
stg goto p1 &&
echo bar1 >> foo1.txt &&
stg refresh &&
@@ -91,8 +91,8 @@ test_expect_success \
stg goto p3 &&
echo bar3 >> foo3.txt &&
stg refresh &&
- [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
stg export &&
stg branch foo
'
@@ -101,8 +101,8 @@ test_expect_success \
'Synchronise second patch with the master branch' \
'
stg sync -B master p2 &&
- [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
test $(cat bar2.txt) = "bar2"
'
@@ -115,13 +115,13 @@ test_expect_success \
test_expect_success \
'Restore the stack status after the failed sync' \
'
- [ "$(echo $(stg applied))" = "p1" ] &&
- [ "$(echo $(stg unapplied))" = "p2 p3" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p2 p3" ] &&
stg resolved -a &&
stg refresh &&
stg goto p3
- [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_expect_success \
@@ -133,12 +133,12 @@ test_expect_success \
test_expect_success \
'Restore the stack status after the failed sync' \
'
- [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
stg resolved -a &&
stg refresh &&
- [ "$(echo $(stg applied))" = "p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_done
diff --git a/t/t2200-rebase.sh b/t/t2200-rebase.sh
index cd43c41..12b4af6 100755
--- a/t/t2200-rebase.sh
+++ b/t/t2200-rebase.sh
@@ -28,7 +28,7 @@ test_expect_success \
'
stg rebase master~1 &&
test `stg id stack:{base}` = `git rev-parse master~1` &&
- test `stg applied | wc -l` = 1
+ test `stg series --applied -c` = 1
'
test_expect_success \
@@ -40,7 +40,7 @@ test_expect_success \
test_expect_success \
'Check patches were re-applied' \
'
- test $(stg applied | wc -l) = 1
+ test $(stg series --applied -c) = 1
'
test_done
diff --git a/t/t2500-clean.sh b/t/t2500-clean.sh
index ad8f892..063572b 100755
--- a/t/t2500-clean.sh
+++ b/t/t2500-clean.sh
@@ -17,11 +17,11 @@ test_expect_success 'Initialize StGit stack' '
'
test_expect_success 'Clean empty patches' '
- [ "$(echo $(stg applied))" = "e0 p0 e1" ] &&
- [ "$(echo $(stg unapplied))" = "e2" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "e0 p0 e1" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "e2" ] &&
stg clean &&
- [ "$(echo $(stg applied))" = "p0" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_expect_success 'Create a conflict' '
@@ -37,8 +37,8 @@ test_expect_success 'Create a conflict' '
test_expect_success 'Make sure conflicting patches are preserved' '
stg clean &&
- [ "$(echo $(stg applied))" = "p0 p2 p1" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p2 p1" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_done
diff --git a/t/t2600-coalesce.sh b/t/t2600-coalesce.sh
index f13a309..ef5bf99 100755
--- a/t/t2600-coalesce.sh
+++ b/t/t2600-coalesce.sh
@@ -15,17 +15,17 @@ test_expect_success 'Initialize StGit stack' '
'
test_expect_success 'Coalesce some patches' '
- [ "$(echo $(stg applied))" = "p0 p1 p2 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ] &&
stg coalesce --name=q0 --message="wee woo" p1 p2 &&
- [ "$(echo $(stg applied))" = "p0 q0 p3" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 q0 p3" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_expect_success 'Coalesce at stack top' '
stg coalesce --name=q1 --message="wee woo wham" q0 p3 &&
- [ "$(echo $(stg applied))" = "p0 q1" ] &&
- [ "$(echo $(stg unapplied))" = "" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 q1" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
'
test_done
diff --git a/t/t3000-dirty-merge.sh b/t/t3000-dirty-merge.sh
index d87bba1..a4e228a 100755
--- a/t/t3000-dirty-merge.sh
+++ b/t/t3000-dirty-merge.sh
@@ -24,11 +24,11 @@ test_expect_success 'Pop one patch and update the other' '
test_expect_success 'Push with dirty worktree' '
echo 4 > a &&
- [ "$(echo $(stg applied))" = "p1" ] &&
- [ "$(echo $(stg unapplied))" = "p2" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
! stg goto p2 &&
- [ "$(echo $(stg applied))" = "p1" ] &&
- [ "$(echo $(stg unapplied))" = "p2" ] &&
+ [ "$(echo $(stg series --applied --noprefix))" = "p1" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p2" ] &&
[ "$(echo $(cat a))" = "4" ]
'
diff --git a/t/t4000-upgrade.sh b/t/t4000-upgrade.sh
index 8a308fb..01fe248 100755
--- a/t/t4000-upgrade.sh
+++ b/t/t4000-upgrade.sh
@@ -14,8 +14,8 @@ for ver in 0.12 0.8; do
test_expect_success \
"v$ver: Check the list of applied and unapplied patches" '
- [ "$(echo $(stg applied))" = "p0 p1 p2" ] &&
- [ "$(echo $(stg unapplied))" = "p3 p4" ]
+ [ "$(echo $(stg series --applied --noprefix))" = "p0 p1 p2" ] &&
+ [ "$(echo $(stg series --unapplied --noprefix))" = "p3 p4" ]
'
test_expect_success \
^ permalink raw reply related
* [StGIT PATCH 3/4] Convert git_id() to the new id format
From: Catalin Marinas @ 2008-06-19 21:42 UTC (permalink / raw)
To: git, Karl Hasselström
In-Reply-To: <20080619214023.27794.97039.stgit@localhost.localdomain>
The patch rewrites git_id() to use the new id format and coverts the
commands using this function. The git_id() will be removed once all the
commands are converted to the new infrastructure where git_commit() will
be used instead.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/common.py | 97 ++++++++-------------------------------------
stgit/commands/diff.py | 21 ++++------
stgit/commands/files.py | 10 ++---
stgit/commands/mail.py | 8 ++--
stgit/commands/pick.py | 10 ++---
stgit/commands/refresh.py | 4 +-
stgit/commands/series.py | 4 +-
t/t2000-sync.sh | 2 -
8 files changed, 43 insertions(+), 113 deletions(-)
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 349389f..3e1d2d0 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -35,101 +35,38 @@ class CmdException(StgException):
pass
# Utility functions
-class RevParseException(StgException):
- """Revision spec parse error."""
- pass
-
def parse_rev(rev):
- """Parse a revision specification into its
- patchname@branchname//patch_id parts. If no branch name has a slash
- in it, also accept / instead of //."""
- if '/' in ''.join(git.get_heads()):
- # We have branch names with / in them.
- branch_chars = r'[^@]'
- patch_id_mark = r'//'
- else:
- # No / in branch names.
- branch_chars = r'[^@/]'
- patch_id_mark = r'(/|//)'
- patch_re = r'(?P<patch>[^@/]+)'
- branch_re = r'@(?P<branch>%s+)' % branch_chars
- patch_id_re = r'%s(?P<patch_id>[a-z.]*)' % patch_id_mark
-
- # Try //patch_id.
- m = re.match(r'^%s$' % patch_id_re, rev)
- if m:
- return None, None, m.group('patch_id')
-
- # Try path[@branch]//patch_id.
- m = re.match(r'^%s(%s)?%s$' % (patch_re, branch_re, patch_id_re), rev)
- if m:
- return m.group('patch'), m.group('branch'), m.group('patch_id')
-
- # Try patch[@branch].
- m = re.match(r'^%s(%s)?$' % (patch_re, branch_re), rev)
- if m:
- return m.group('patch'), m.group('branch'), None
-
- # No, we can't parse that.
- raise RevParseException
+ """Parse a revision specification into its branch:patch parts.
+ """
+ try:
+ branch, patch = rev.split(':', 1)
+ except ValueError:
+ branch = None
+ patch = rev
+
+ return (branch, patch)
def git_id(crt_series, rev):
"""Return the GIT id
"""
+ # TODO: remove this function once all the occurrences were converted
+ # to git_commit()
if not rev:
+ # backwards compatibility
return None
+ repository = libstack.Repository.default()
+ return git_commit(rev, repository, crt_series.get_name()).sha1
- # try a GIT revision first
- try:
- return git.rev_parse(rev + '^{commit}')
- except git.GitException:
- pass
-
- # try an StGIT patch name
- try:
- patch, branch, patch_id = parse_rev(rev)
- if branch == None:
- series = crt_series
- else:
- series = stack.Series(branch)
- if patch == None:
- patch = series.get_current()
- if not patch:
- raise CmdException, 'No patches applied'
- if patch in series.get_applied() or patch in series.get_unapplied() or \
- patch in series.get_hidden():
- if patch_id in ['top', '', None]:
- return series.get_patch(patch).get_top()
- elif patch_id == 'bottom':
- return series.get_patch(patch).get_bottom()
- elif patch_id == 'top.old':
- return series.get_patch(patch).get_old_top()
- elif patch_id == 'bottom.old':
- return series.get_patch(patch).get_old_bottom()
- elif patch_id == 'log':
- return series.get_patch(patch).get_log()
- if patch == 'base' and patch_id == None:
- return series.get_base()
- except RevParseException:
- pass
- except stack.StackException:
- pass
-
- raise CmdException, 'Unknown patch or revision: %s' % rev
-
-def git_commit(name, repository, branch = None):
+def git_commit(name, repository, branch_name = None):
"""Return the a Commit object if 'name' is a patch name or Git commit.
The patch names allowed are in the form '<branch>:<patch>' and can be
followed by standard symbols used by git-rev-parse. If <patch> is '{base}',
it represents the bottom of the stack.
"""
# Try a [branch:]patch name first
- try:
- branch, patch = name.split(':', 1)
- except ValueError:
- patch = name
+ branch, patch = parse_rev(name)
if not branch:
- branch = repository.current_branch_name
+ branch = branch_name or repository.current_branch_name
# The stack base
if patch == '{base}':
diff --git a/stgit/commands/diff.py b/stgit/commands/diff.py
index fd6be34..4ae9b49 100644
--- a/stgit/commands/diff.py
+++ b/stgit/commands/diff.py
@@ -30,17 +30,14 @@ help = 'show the tree diff'
usage = """%prog [options] [<files or dirs>]
Show the diff (default) or diffstat between the current working copy
-or a tree-ish object and another tree-ish object. File names can also
-be given to restrict the diff output. The tree-ish object can be a
-standard git commit, tag or tree. In addition to these, the command
-also supports 'base', representing the bottom of the current stack,
-and '[patch][//[bottom | top]]' for the patch boundaries (defaulting to
-the current one):
+or a tree-ish object and another tree-ish object (defaulting to HEAD).
+File names can also be given to restrict the diff output. The
+tree-ish object can be an StGIT patch, a standard git commit, tag or
+tree. In addition to these, the command also supports '{base}',
+representing the bottom of the current stack.
-rev = '([patch][//[bottom | top]]) | <tree-ish> | base'
-
-If neither bottom nor top are given but a '//' is present, the command
-shows the specified patch (defaulting to the current one)."""
+rev = '([branch:]patch) | <tree-ish> | base'
+"""
directory = DirectoryHasRepository()
options = [make_option('-r', '--range',
@@ -67,8 +64,8 @@ def func(parser, options, args):
rev = strip_suffix('/', rev)
if rev.endswith('/'):
rev = strip_suffix('/', rev)
- rev1 = rev + '//bottom'
- rev2 = rev + '//top'
+ rev1 = rev + 'HEAD^'
+ rev2 = rev + 'HEAD'
else:
rev1 = rev_list[0]
rev2 = None
diff --git a/stgit/commands/files.py b/stgit/commands/files.py
index b43b12f..d240872 100644
--- a/stgit/commands/files.py
+++ b/stgit/commands/files.py
@@ -26,7 +26,7 @@ from stgit import stack, git
help = 'show the files modified by a patch (or the current patch)'
-usage = """%prog [options] [<patch>]
+usage = """%prog [options] [[<branch>:]<patch>]
List the files modified by the given patch (defaulting to the current
one). Passing the '--stat' option shows the diff statistics for the
@@ -38,8 +38,6 @@ directory = DirectoryHasRepository()
options = [make_option('-s', '--stat',
help = 'show the diff stat',
action = 'store_true'),
- make_option('-b', '--branch',
- help = 'use BRANCH instead of the default one'),
make_option('--bare',
help = 'bare file names (useful for scripting)',
action = 'store_true')
@@ -50,14 +48,14 @@ def func(parser, options, args):
"""Show the files modified by a patch (or the current patch)
"""
if len(args) == 0:
- patch = ''
+ patch = 'HEAD'
elif len(args) == 1:
patch = args[0]
else:
parser.error('incorrect number of arguments')
- rev1 = git_id(crt_series, '%s//bottom' % patch)
- rev2 = git_id(crt_series, '%s//top' % patch)
+ rev1 = git_id(crt_series, '%s^' % patch)
+ rev2 = git_id(crt_series, '%s' % patch)
if options.stat:
out.stdout_raw(git.diffstat(git.diff(rev1 = rev1, rev2 = rev2)) + '\n')
diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index c87d67e..e04dc2f 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -383,8 +383,8 @@ def __build_cover(tmpl, patches, msg_id, options):
'shortlog': stack.shortlog(crt_series.get_patch(p)
for p in patches),
'diffstat': git.diffstat(git.diff(
- rev1 = git_id(crt_series, '%s//bottom' % patches[0]),
- rev2 = git_id(crt_series, '%s//top' % patches[-1])))}
+ rev1 = git_id(crt_series, '%s^' % patches[0]),
+ rev2 = git_id(crt_series, '%s' % patches[-1])))}
try:
msg_string = tmpl % tmpl_dict
@@ -460,8 +460,8 @@ def __build_message(tmpl, patch, patch_nr, total_nr, msg_id, ref_id, options):
else:
number_str = ''
- diff = git.diff(rev1 = git_id(crt_series, '%s//bottom' % patch),
- rev2 = git_id(crt_series, '%s//top' % patch),
+ diff = git.diff(rev1 = git_id(crt_series, '%s^' % patch),
+ rev2 = git_id(crt_series, '%s' % patch),
diff_flags = options.diff_flags)
tmpl_dict = {'patch': patch,
'sender': sender,
diff --git a/stgit/commands/pick.py b/stgit/commands/pick.py
index 1f7c84b..2a670e8 100644
--- a/stgit/commands/pick.py
+++ b/stgit/commands/pick.py
@@ -87,8 +87,8 @@ def __pick_commit(commit_id, patchname, options):
out.done()
elif options.update:
- rev1 = git_id(crt_series, '//bottom')
- rev2 = git_id(crt_series, '//top')
+ rev1 = git_id(crt_series, 'HEAD^')
+ rev2 = git_id(crt_series, 'HEAD')
files = git.barefiles(rev1, rev2).split('\n')
out.start('Updating with commit %s' % commit_id)
@@ -115,10 +115,8 @@ def __pick_commit(commit_id, patchname, options):
patchname = newpatch.get_name()
# find a patchlog to fork from
- (refpatchname, refbranchname, refpatchid) = parse_rev(patchname)
- if refpatchname and not refpatchid and \
- (not refpatchid or refpatchid == 'top'):
- # FIXME: should also support picking //top.old
+ refbranchname, refpatchname = parse_rev(patchname)
+ if refpatchname:
if refbranchname:
# assume the refseries is OK, since we already resolved
# commit_str to a git_id
diff --git a/stgit/commands/refresh.py b/stgit/commands/refresh.py
index 4695c62..73e4ee0 100644
--- a/stgit/commands/refresh.py
+++ b/stgit/commands/refresh.py
@@ -103,8 +103,8 @@ def func(parser, options, args):
between = applied[:applied.index(patch):-1]
pop_patches(crt_series, between, keep = True)
elif options.update:
- rev1 = git_id(crt_series, '//bottom')
- rev2 = git_id(crt_series, '//top')
+ rev1 = git_id(crt_series, 'HEAD^')
+ rev2 = git_id(crt_series, 'HEAD')
patch_files = git.barefiles(rev1, rev2).split('\n')
files = [f for f in files if f in patch_files]
if not files:
diff --git a/stgit/commands/series.py b/stgit/commands/series.py
index 04183bd..c11c74f 100644
--- a/stgit/commands/series.py
+++ b/stgit/commands/series.py
@@ -88,7 +88,7 @@ def __print_patch(stack, patch, branch_str, prefix, empty_prefix, length, option
elif options.empty and stack.patches.get(patch).is_empty():
prefix = empty_prefix
- patch_str = patch + branch_str
+ patch_str = branch_str + patch
if options.description or options.author:
patch_str = patch_str.ljust(length)
@@ -164,7 +164,7 @@ def func(parser, options, args):
return
if options.showbranch:
- branch_str = '@' + stack.name
+ branch_str = stack.name + ':'
else:
branch_str = ''
diff --git a/t/t2000-sync.sh b/t/t2000-sync.sh
index e489603..4a00c56 100755
--- a/t/t2000-sync.sh
+++ b/t/t2000-sync.sh
@@ -37,7 +37,7 @@ test_expect_success \
test_expect_success \
'Create a branch with empty patches' \
'
- stg branch -c foo base &&
+ stg branch -c foo {base} &&
stg new p1 -m p1 &&
stg new p2 -m p2 &&
stg new p3 -m p3 &&
^ permalink raw reply related
* [StGIT PATCH 2/4] Implement a new patch identification scheme and id command
From: Catalin Marinas @ 2008-06-19 21:42 UTC (permalink / raw)
To: git, Karl Hasselström
In-Reply-To: <20080619214023.27794.97039.stgit@localhost.localdomain>
The new scheme allows '[<branch>:]<patch>' and '[<branch>:]{base}'
(the latter showing the base of a stack). The former format allows
symbols like ^ and ^{...}.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
stgit/commands/common.py | 32 ++++++++++++++++++++++++++++++++
stgit/commands/id.py | 28 ++++++++++++----------------
stgit/lib/git.py | 4 ++--
t/t0001-subdir-branches.sh | 24 ++++++++++--------------
t/t1200-push-modified.sh | 2 +-
t/t1201-pull-trailing.sh | 2 +-
t/t2200-rebase.sh | 2 +-
7 files changed, 59 insertions(+), 35 deletions(-)
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index 029ec65..349389f 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -28,6 +28,7 @@ from stgit.run import *
from stgit import stack, git, basedir
from stgit.config import config, file_extensions
from stgit.lib import stack as libstack
+from stgit.lib import git as libgit
# Command exception class
class CmdException(StgException):
@@ -116,6 +117,37 @@ def git_id(crt_series, rev):
raise CmdException, 'Unknown patch or revision: %s' % rev
+def git_commit(name, repository, branch = None):
+ """Return the a Commit object if 'name' is a patch name or Git commit.
+ The patch names allowed are in the form '<branch>:<patch>' and can be
+ followed by standard symbols used by git-rev-parse. If <patch> is '{base}',
+ it represents the bottom of the stack.
+ """
+ # Try a [branch:]patch name first
+ try:
+ branch, patch = name.split(':', 1)
+ except ValueError:
+ patch = name
+ if not branch:
+ branch = repository.current_branch_name
+
+ # The stack base
+ if patch == '{base}':
+ return repository.get_stack(branch).base
+
+ # Other combination of branch and patch
+ try:
+ return repository.rev_parse('patches/%s/%s' % (branch, patch),
+ discard_stderr = True)
+ except libgit.RepositoryException:
+ pass
+
+ # Try a Git commit
+ try:
+ return repository.rev_parse(name, discard_stderr = True)
+ except libgit.RepositoryException:
+ raise CmdException('%s: Unknown patch or revision name' % name)
+
def check_local_changes():
if git.local_changes():
raise CmdException('local changes in the tree. Use "refresh" or'
diff --git a/stgit/commands/id.py b/stgit/commands/id.py
index 94b0229..3819acc 100644
--- a/stgit/commands/id.py
+++ b/stgit/commands/id.py
@@ -15,28 +15,24 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import sys, os
from optparse import OptionParser, make_option
-from stgit.commands.common import *
-from stgit.utils import *
-from stgit.out import *
-from stgit import stack, git
-
+from stgit.out import out
+from stgit.commands import common
+from stgit.lib import stack
help = 'print the GIT hash value of a StGIT reference'
usage = """%prog [options] [id]
-Print the hash value of a GIT id (defaulting to HEAD). In addition to
-the standard GIT id's like heads and tags, this command also accepts
-'base[@<branch>]' and '[<patch>[@<branch>]][//[bottom | top]]'. If no
-'top' or 'bottom' are passed and <patch> is a valid patch name, 'top'
-will be used by default."""
-
-directory = DirectoryHasRepository()
-options = [make_option('-b', '--branch',
- help = 'use BRANCH instead of the default one')]
+Print the SHA1 value of a Git id (defaulting to HEAD). In addition to
+the standard Git id's like heads and tags, this command also accepts
+'[<branch>:]<patch>' and '[<branch>:]{base}' showing the id of a patch
+or the base of the stack. If no branch is specified, it defaults to the
+current one. The bottom of a patch is accessible with the
+'[<branch>:]<patch>^' format."""
+directory = common.DirectoryHasRepositoryLib()
+options = []
def func(parser, options, args):
"""Show the applied patches
@@ -48,4 +44,4 @@ def func(parser, options, args):
else:
parser.error('incorrect number of arguments')
- out.stdout(git_id(crt_series, id_str))
+ out.stdout(common.git_commit(id_str, directory.repository).sha1)
diff --git a/stgit/lib/git.py b/stgit/lib/git.py
index 6ccdfa7..4746da3 100644
--- a/stgit/lib/git.py
+++ b/stgit/lib/git.py
@@ -422,11 +422,11 @@ class Repository(RunWithEnv):
refs = property(lambda self: self.__refs)
def cat_object(self, sha1):
return self.run(['git', 'cat-file', '-p', sha1]).raw_output()
- def rev_parse(self, rev):
+ def rev_parse(self, rev, discard_stderr = False):
try:
return self.get_commit(self.run(
['git', 'rev-parse', '%s^{commit}' % rev]
- ).output_one_line())
+ ).discard_stderr(discard_stderr).output_one_line())
except run.RunException:
raise RepositoryException('%s: No such revision' % rev)
def get_tree(self, sha1):
diff --git a/t/t0001-subdir-branches.sh b/t/t0001-subdir-branches.sh
index 0eed3a4..4df0481 100755
--- a/t/t0001-subdir-branches.sh
+++ b/t/t0001-subdir-branches.sh
@@ -18,25 +18,21 @@ test_expect_success 'Create a patch' \
stg new foo -m "Add foo.txt" &&
stg refresh'
-test_expect_success 'Old and new id with non-slashy branch' \
- 'stg id foo &&
- stg id foo// &&
- stg id foo/ &&
- stg id foo//top &&
- stg id foo/top &&
- stg id foo@master &&
- stg id foo@master//top &&
- stg id foo@master/top'
+test_expect_success 'Try id with non-slashy branch' \
+ 'stg id &&
+ stg id foo &&
+ stg id foo^ &&
+ stg id master:foo &&
+ stg id master:foo^'
test_expect_success 'Clone branch to slashier name' \
'stg branch --clone x/y/z'
-test_expect_success 'Try new form of id with slashy branch' \
+test_expect_success 'Try new id with slashy branch' \
'stg id foo &&
- stg id foo// &&
- stg id foo//top &&
- stg id foo@x/y/z &&
- stg id foo@x/y/z//top'
+ stg id foo^ &&
+ stg id x/y/z:foo &&
+ stg id x/y/z:foo^'
test_expect_success 'Try old id with slashy branch' '
! stg id foo/ &&
diff --git a/t/t1200-push-modified.sh b/t/t1200-push-modified.sh
index ba4f70c..e3c6425 100755
--- a/t/t1200-push-modified.sh
+++ b/t/t1200-push-modified.sh
@@ -36,7 +36,7 @@ test_expect_success \
(
cd foo &&
GIT_DIR=../bar/.git git-format-patch --stdout \
- $(cd ../bar && stg id base@master)..HEAD | git-am -3 -k
+ $(cd ../bar && stg id master:{base})..HEAD | git-am -3 -k
)
'
diff --git a/t/t1201-pull-trailing.sh b/t/t1201-pull-trailing.sh
index 9d70fe0..8a74873 100755
--- a/t/t1201-pull-trailing.sh
+++ b/t/t1201-pull-trailing.sh
@@ -30,7 +30,7 @@ test_expect_success \
'Port those patches to orig tree' \
'(cd foo &&
GIT_DIR=../bar/.git git-format-patch --stdout \
- $(cd ../bar && stg id base@master)..HEAD |
+ $(cd ../bar && stg id master:{base})..HEAD |
git-am -3 -k
)
'
diff --git a/t/t2200-rebase.sh b/t/t2200-rebase.sh
index ec2a104..cd43c41 100755
--- a/t/t2200-rebase.sh
+++ b/t/t2200-rebase.sh
@@ -27,7 +27,7 @@ test_expect_success \
'Rebase to previous commit' \
'
stg rebase master~1 &&
- test `stg id base@stack` = `git rev-parse master~1` &&
+ test `stg id stack:{base}` = `git rev-parse master~1` &&
test `stg applied | wc -l` = 1
'
^ permalink raw reply related
* [StGIT PATCH 1/4] Allow e-mails to be sent with the Unix sendmail tool
From: Catalin Marinas @ 2008-06-19 21:42 UTC (permalink / raw)
To: git, Karl Hasselström
In-Reply-To: <20080619214023.27794.97039.stgit@localhost.localdomain>
If the stgit.smtpserver configuration option does not have a host:port
format, it is assumed to be an external tool. For example, to use
sendmail just set this variable to "/usr/sbin/sendmail -t -i" (see the
examples/gitconfig file).
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
examples/gitconfig | 1 +
stgit/commands/mail.py | 46 ++++++++++++++++++++++++++++++++++------------
stgit/config.py | 2 +-
3 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/examples/gitconfig b/examples/gitconfig
index c16f786..28d94af 100644
--- a/examples/gitconfig
+++ b/examples/gitconfig
@@ -19,6 +19,7 @@
#autoresolved = no
# SMTP server for sending patches
+ #smtpserver = /usr/sbin/sendmail -t -i
#smtpserver = localhost:25
# Set to 'yes' to use SMTP over TLS
diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py
index b4d4e18..c87d67e 100644
--- a/stgit/commands/mail.py
+++ b/stgit/commands/mail.py
@@ -24,6 +24,7 @@ from stgit.utils import *
from stgit.out import *
from stgit import stack, git, version, templates
from stgit.config import config
+from stgit.run import Run
help = 'send a patch or series of patches by e-mail'
@@ -31,13 +32,15 @@ usage = r"""%prog [options] [<patch1>] [<patch2>] [<patch3>..<patch4>]
Send a patch or a range of patches by e-mail using the SMTP server
specified by the 'stgit.smtpserver' configuration option, or the
-'--smtp-server' command line option. The From address and the e-mail
-format are generated from the template file passed as argument to
-'--template' (defaulting to '.git/patchmail.tmpl' or
-'~/.stgit/templates/patchmail.tmpl' or
+'--smtp-server' command line option. This option can also be an
+absolute path to 'sendmail' followed by command line arguments.
+
+The From address and the e-mail format are generated from the template
+file passed as argument to '--template' (defaulting to
+'.git/patchmail.tmpl' or '~/.stgit/templates/patchmail.tmpl' or
'/usr/share/stgit/templates/patchmail.tmpl'). A patch can be sent as
-attachment using the --attach option in which case the 'mailattch.tmpl'
-template will be used instead of 'patchmail.tmpl'.
+attachment using the --attach option in which case the
+'mailattch.tmpl' template will be used instead of 'patchmail.tmpl'.
The To/Cc/Bcc addresses can either be added to the template file or
passed via the corresponding command line options. They can be e-mail
@@ -133,8 +136,9 @@ options = [make_option('-a', '--all',
help = 'sleep for SECONDS between e-mails sending'),
make_option('--refid',
help = 'use REFID as the reference id'),
- make_option('--smtp-server', metavar = 'HOST[:PORT]',
- help = 'SMTP server to use for sending mail'),
+ make_option('--smtp-server',
+ metavar = 'HOST[:PORT] or "/path/to/sendmail -t -i"',
+ help = 'SMTP server or command to use for sending mail'),
make_option('-u', '--smtp-user', metavar = 'USER',
help = 'username for SMTP authentication'),
make_option('-p', '--smtp-password', metavar = 'PASSWORD',
@@ -184,8 +188,14 @@ def __parse_addresses(msg):
return (from_addr_list[0], to_addr_list)
-def __send_message(smtpserver, from_addr, to_addr_list, msg, sleep,
- smtpuser, smtppassword, use_tls):
+def __send_message_sendmail(sendmail, msg):
+ """Send the message using the sendmail command.
+ """
+ cmd = sendmail.split()
+ Run(*cmd).raw_input(msg).discard_output()
+
+def __send_message_smtp(smtpserver, from_addr, to_addr_list, msg,
+ smtpuser, smtppassword, use_tls):
"""Send the message using the given SMTP server
"""
try:
@@ -207,13 +217,25 @@ def __send_message(smtpserver, from_addr, to_addr_list, msg, sleep,
result = s.sendmail(from_addr, to_addr_list, msg)
if len(result):
print "mail server refused delivery for the following recipients: %s" % result
- # give recipients a chance of receiving patches in the correct order
- time.sleep(sleep)
except Exception, err:
raise CmdException, str(err)
s.quit()
+def __send_message(smtpserver, from_addr, to_addr_list, msg,
+ sleep, smtpuser, smtppassword, use_tls):
+ """Message sending dispatcher.
+ """
+ if smtpserver.startswith('/'):
+ # Use the sendmail tool
+ __send_message_sendmail(smtpserver, msg)
+ else:
+ # Use the SMTP server (we have host and port information)
+ __send_message_smtp(smtpserver, from_addr, to_addr_list, msg,
+ smtpuser, smtppassword, use_tls)
+ # give recipients a chance of receiving patches in the correct order
+ time.sleep(sleep)
+
def __build_address_headers(msg, options, extra_cc = []):
"""Build the address headers and check existing headers in the
template.
diff --git a/stgit/config.py b/stgit/config.py
index 9bfdd52..9b26fa6 100644
--- a/stgit/config.py
+++ b/stgit/config.py
@@ -29,7 +29,7 @@ class GitConfigException(StgException):
class GitConfig:
__defaults={
'stgit.autoresolved': 'no',
- 'stgit.smtpserver': 'localhost:25',
+ 'stgit.smtpserver': '/usr/sbin/sendmail -t -i',
'stgit.smtpdelay': '5',
'stgit.pullcmd': 'git pull',
'stgit.fetchcmd': 'git fetch',
^ permalink raw reply related
* Re: Including branch info in git format-patch
From: Junio C Hamano @ 2008-06-19 21:41 UTC (permalink / raw)
To: Mukund Sivaraman; +Cc: Jeff King, git
In-Reply-To: <20080619212626.GA29643@jurassic>
Mukund Sivaraman <muks@banu.com> writes:
> My problem is that I can't send a patch out to the list for other
> developers to try, without some annotation for them, of which branch to
> try it on.
So what's wrong telling that when you send out the patch, between the time
you run format-patch and send-email?
^ permalink raw reply
* [StGIT PATCH 0/4] Proposed patches
From: Catalin Marinas @ 2008-06-19 21:41 UTC (permalink / raw)
To: git, Karl Hasselström
A short series of proposed patches for merging into the StGIT master
branch. The most important is the new patch identification scheme.
---
Catalin Marinas (4):
Remove the applied/unapplied commands
Convert git_id() to the new id format
Implement a new patch identification scheme and id command
Allow e-mails to be sent with the Unix sendmail tool
examples/gitconfig | 1
stgit/commands/applied.py | 51 --------------------
stgit/commands/common.py | 107 +++++++++++++++----------------------------
stgit/commands/diff.py | 21 ++++----
stgit/commands/files.py | 10 ++--
stgit/commands/id.py | 28 +++++------
stgit/commands/mail.py | 54 +++++++++++++++-------
stgit/commands/pick.py | 10 ++--
stgit/commands/refresh.py | 4 +-
stgit/commands/series.py | 17 +++++--
stgit/commands/unapplied.py | 50 --------------------
stgit/config.py | 2 -
stgit/lib/git.py | 4 +-
stgit/main.py | 4 --
t/t0001-subdir-branches.sh | 24 ++++------
t/t1002-branch-clone.sh | 6 +-
t/t1003-new.sh | 4 +-
t/t1200-push-modified.sh | 14 +++---
t/t1201-pull-trailing.sh | 2 -
t/t1203-pop.sh | 12 ++---
t/t1204-pop-keep.sh | 12 ++---
t/t1205-push-subdir.sh | 4 +-
t/t1301-repair.sh | 12 ++---
t/t1302-repair-interop.sh | 20 ++++----
t/t1500-float.sh | 14 +++---
t/t1600-delete-one.sh | 28 ++++++-----
t/t1601-delete-many.sh | 24 +++++-----
t/t2000-sync.sh | 50 ++++++++++----------
t/t2200-rebase.sh | 6 +-
t/t2500-clean.sh | 12 ++---
t/t2600-coalesce.sh | 12 ++---
t/t3000-dirty-merge.sh | 8 ++-
t/t4000-upgrade.sh | 4 +-
33 files changed, 256 insertions(+), 375 deletions(-)
delete mode 100644 stgit/commands/applied.py
delete mode 100644 stgit/commands/unapplied.py
--
Catalin
^ permalink raw reply
* Re: [PATCH - stgit] Patch to allow import of compressed files
From: David Kågedal @ 2008-06-19 14:17 UTC (permalink / raw)
To: git
In-Reply-To: <20080610063328.GB26965@diana.vm.bytemark.co.uk>
Karl Hasselström <kha@treskal.com> writes:
> On 2008-06-09 13:38:55 -0500, Clark Williams wrote:
>
>> This patch allows StGit to directly import compressed (.gz and .bz2)
>> files with reasonable patch names.
>>
>> I do a lot of work on modified kernel trees and usually the first
>> two things imported are a stable update patch followed immediately
>> by an -rt patch, both of which are compressed. With this patch I can
>> just copy the files down directly from kernel.org and import them,
>> rather than having to keep uncompressed copies around.
>>
>> Hey, I'm lazy... :)
>
> Lazy is good. Thanks for the patch!
>
>> + if filename.endswith(".gz"):
>> + import gzip
>> + f = gzip.open(filename)
>> + pname = filename.replace(".gz", "")
>> + elif filename.endswith(".bz2"):
>> + import bz2
>> + f = bz2.BZ2File(filename, 'r')
>> + pname = filename.replace(".bz2", "")
>
> Some comments here:
>
> * By my reading of the docs, the second argument to BZ2File defaults
> to 'r' anyway, so you could omit it.
>
> * We try to use single quotes wherever possible (except when triple
> quoting). You're using a mix ...
>
> * .replace() will happily replace anywhere in the string. Please
> consider using stgit.util.strip_suffix() instead.
Or use os.path.splitext(filename) which will save you a couple of
endswith calls as well.
> And last but not least, it'd be terrific if you'd let me bully you
> into adding .gz and .bz2 test cases for t1800-import. :-)
--
David Kågedal <david@kagedal.org>
^ permalink raw reply
* Re: [PATCH] git-apply doesn't handle same name patches well [V3]
From: Don Zickus @ 2008-06-19 21:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vbq1z375d.fsf@gitster.siamese.dyndns.org>
On Tue, Jun 17, 2008 at 05:42:54PM -0700, Junio C Hamano wrote:
> Don Zickus <dzickus@redhat.com> writes:
>
> > When working with a lot of people who backport patches all day long, every
> > once in a while I get a patch that modifies the same file more than once
> > inside the same patch. git-apply either fails if the second change relies
> > on the first change or silently drops the first change if the second change
> > is independent.
>
> Good issue to tackle.
>
> > A new test has been added to cover the cases I addressed. However,
> > currently adding changes to renamed file inside the same patch doesn't work
> > correctly (it fails to find new file). I didn't know how to fix this
> > correctly, so I have the test fail expectedly.
>
> Do you mean that the first patch rename-edits A to B, and then the second
> patch edits B in place? Because your fn_cache is keyed by postimage
> filename (in this case B), I would imagine that the later lookup of B
> should successfully find the patch result from the previous one. Unless
> the in_fn_cache() is somehow wrong...
Yeah, I thought so too, but after debugging the problem, the 'lstat' in
check_preimage() fails to find the file on disk and exits with that error.
I was going to try to figure out a way to grab it from fn_cache but I
wasn't sure how much of the 'lstat' info is needed later.
>
> or do you mean that the first patch rename-edits A to B, but the second
> one still wants to edit A in place and you would want to pretend as if the
> later one is for a patch to B? I would think that is doable but asking
> for too much magic, and a tool with too much magic is scary.
Personally I think this case should be a failure. I even attached a
testcase in my patch to make sure this failed. I wasn't comfortable doing
this magic either.
> > +/*
> > + * Caches patch filenames to handle the case where a
> > + * patch chunk reuses a filename
> > + */
> > +
> > +struct path_list fn_cache = {NULL, 0, 0, 0};
>
> "Reuses a filename"? Do you mean touches the same file again?
>
> This is not a "cache" in the sense that you can nuke it without changing
> the behaviour except performance, but more about "Record the postimage
> pathnames (and contents, indirectly by pointing at the patch structure)
> each previous patch application would have created".
Yes, poor choice of words. I'll try to think of a something else.
>
> There is a case where a normal git patch contains two separate patches to
> the same file. A typechange patch is always expressed as a deletion of
> the old path immediately followed by a creation of the same path. I have
> to wonder why that codepath for handing that particular special case is
> not changed in this patch. Surely the mechanism you are adding is a
> generalization that can cover such a case as well, isn't it?
Heh. Maybe, but I didn't know the code well enough to do that. Pointers?
I'll try to poke around and see what I can cleanup, but I will have to
rely on the mailing-list to make sure I did it correctly.
>
> > @@ -2176,6 +2184,38 @@ static int read_file_or_gitlink(struct cache_entry *ce, struct strbuf *buf)
> > return 0;
> > }
> >
> > +struct patch *in_fn_cache(char *name)
> > +{
> > + struct path_list_item *item;
> > +
> > + item = path_list_lookup(name, &fn_cache);
> > + if (item != NULL)
> > + return (struct patch *)item->util;
> > +
> > + return NULL;
> > +}
> > +
> > +void add_to_fn_cache(char *name, struct patch *patch)
> > +{
> > + struct path_list_item *item;
> > +
> > + /* Always add new_name unless patch is a deletion */
> > + if (name != NULL) {
> > + item = path_list_insert(name, &fn_cache);
> > + item->util = patch;
> > + }
> > +
> > + /* skip normal diffs, creations and copies */
>
> This comment is a "Huh?".
I was just making a note about which cases I wanted to skip and which ones
I wanted to process. I can expand on it. For example, patches that
contain normal diffs, file creations and git copies or ignored as don't
cares. Only file deletions and git renames were interesting to me in the
code below.
>
> > + /*
> > + * store a failure on rename/deletion cases because
> > + * later chunks shouldn't patch old names
> > + */
> > + if ((name == NULL) || (patch->is_rename)) {
> > + item = path_list_insert(patch->old_name, &fn_cache);
> > + item->util = (struct patch *) -1;
>
> If you look at the patch->old_name _anyway_, why do you give a separate
> name parameter to this function? The function would be much easier to
> read if you pass only patch, and use patch->new_name instead of the
> separate name parameter. Otherwise the reader needs to scroll down and
> figure out that name is a new name by looking at the call site to
> understand what is going on.
Yeah, leftover code that was added when I ran into rename and copy
problems.
>
> > + }
> > +}
> > +
> > static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *ce)
> > {
> > struct strbuf buf;
> > @@ -2188,7 +2228,16 @@ static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
> > if (read_file_or_gitlink(ce, &buf))
> > return error("read of %s failed", patch->old_name);
> > } else if (patch->old_name) {
> > - if (S_ISGITLINK(patch->old_mode)) {
> > + struct patch *tpatch = in_fn_cache(patch->old_name);
> > +
> > + if (tpatch != NULL) {
> > + if (tpatch == (struct patch *) -1) {
> > + return error("patch %s has been renamed/deleted",
> > + patch->old_name);
> > + }
> > + /* We have a patched copy in memory use that */
> > + strbuf_add(&buf, tpatch->result, tpatch->resultsize);
> > + } else if (S_ISGITLINK(patch->old_mode)) {
>
> Isn't this wrong? Why can't this new enhancement be used while operating
> only on the index?
I don't know, can it? You tell me. I wasn't sure on the whole index
thing worked.
I'll respin the patch when I get some free time tomorrow or next week.
Cheers,
Don
^ permalink raw reply
* Re: Including branch info in git format-patch
From: Mukund Sivaraman @ 2008-06-19 21:26 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, git
In-Reply-To: <7vskv9rvrc.fsf@gitster.siamese.dyndns.org>
On Thu, Jun 19, 2008 at 01:54:15PM -0700, Junio C Hamano wrote:
> If you have a history of this shape:
>
> (other cruft)
> \
> ----o---o next
> /
> o---o---o---o master
> / /
> ---o---o---A
>
> which "branch label" would you give to the format-patch output that shows
> commit A? It may apply to both master and next, and it is really up to
> the project's convention what to do with it. The side branch the patch
> was developed on may be named "quick-hack", which would not have any
> relevance to the final location of where that patch wants to be in.
I follow what you are saying. In our workflow case, pointing out the
remote (public) branch name should be sufficient (as this's the public
shared branch among us, and all patchsets shared with others are against
the public branches). Perhaps I can add it to the [PATCH] text in the
subject line as Jeff suggests.
My problem is that I can't send a patch out to the list for other
developers to try, without some annotation for them, of which branch to
try it on.
Mukund
^ permalink raw reply
* Re: suggestions for generating diffs through the revision list
From: Don Zickus @ 2008-06-19 21:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v63s767mb.fsf@gitster.siamese.dyndns.org>
On Tue, Jun 17, 2008 at 03:04:28PM -0700, Junio C Hamano wrote:
> Don Zickus <dzickus@redhat.com> writes:
>
> > I am try to walk the revision history for a given path and analyze the
> > diff (as compared to its parent). What is the proper way of doing that?
> >
> > I noticed a bunch of 'library' calls such as
> >
> > init_revsion(&revs);
> > setup_revisions(argc, argv, &revs, "HEAD");
> > prepare_revision_walk(&revs, NULL);
> > commit = get_revision(&revs);
> >
> > But what I can't find is the way to generate diffs. I see lots and lots
> > of code to do it, but every builtin seems to do it differently. Not
> > knowing the internals that well, I was hoping for some advice.
> >
> > I stumbled upon calls like
> >
> > run_diff_files
> > run_diff_index
> >
> > but I haven't seen how to use them correctly.
>
> Documentation/technical/api-*.txt
Hmm. Thanks. I was trying to keep the diffs in memory and I couldn't find
anything in the api-*.txt that did anything but dump the output the stdout
or a file.
Anyway I just copied a bunch of code from builtin-blame.c and got my tool
to do what I wanted it to do, for now.
Cheers,
Don
^ permalink raw reply
* [PATCH] completion: add --graph to log command completion
From: Dan McGee @ 2008-06-19 21:15 UTC (permalink / raw)
To: spearce; +Cc: git, Dan McGee
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
contrib/completion/git-completion.bash | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 2141b6b..0eb8df0 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -761,6 +761,7 @@ _git_log ()
--pretty= --name-status --name-only --raw
--not --all
--left-right --cherry-pick
+ --graph
"
return
;;
--
1.5.6
^ permalink raw reply related
* Re: Including branch info in git format-patch
From: Sverre Rabbelier @ 2008-06-19 21:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, Mukund Sivaraman, git
In-Reply-To: <7vskv9rvrc.fsf@gitster.siamese.dyndns.org>
On Thu, Jun 19, 2008 at 10:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Jeff King <peff@peff.net> writes:
>
>> You could potentially add a config option to put the branch name inside
>> the '[PATCH]' text. This text is generally stripped away before
>> applying, so it would still free up the receiver to apply on whatever
>> branch they wanted. I don't think it would make sense for git
>> development, since we typically use topic branches, so keeping it
>> configurable would make sense.
>
> People would work on individual patches on topic branches that are named
> differently from the branch on the other end anyway (the branch that
> corresonds to the other end will be used for local integration testing in
> such a setup), so I do not see much point in stating which local branch
> happened to have been checked out when the patch was generated, in the
> output.
I think what Mukund is asking for is a way to specify what upstream
branch the commit should be applied to. This would be a feature to
help the person who is going to do the applying, so it is ok if the
person formatting the patch has to do a little work for that (e.g.,
specify which upstream branch to format-patch as a cmdline option)
> If you have a history of this shape:
<snip>
> which "branch label" would you give to the format-patch output that shows
> commit A? It may apply to both master and next, and it is really up to
> the project's convention what to do with it. The side branch the patch
> was developed on may be named "quick-hack", which would not have any
> relevance to the final location of where that patch wants to be in.
You would give it the label of the branch you want it applied to!
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* name-rev --stdin is slow
From: Lea Wiemann @ 2008-06-19 21:10 UTC (permalink / raw)
To: Git Mailing List
name-rev --stdin has some really high start-up time. The example below
is on my git.git branch. Is this unavoidable to make name-rev fast for
naming high numbers of revisions -- i.e. is it about amortization?
Still, 0.7 seconds seems pretty excessive, and on linux-2.6 it even
takes 6 seconds.
Anyone care to look into it?
$ time echo HEAD | git name-rev --stdin
HEAD
real 0m0.748s
user 0m0.588s
sys 0m0.080s
$ time git name-rev HEAD
HEAD master
real 0m0.041s
user 0m0.016s
sys 0m0.028s
^ permalink raw reply
* Re: Including branch info in git format-patch
From: Jeff King @ 2008-06-19 21:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Mukund Sivaraman, git
In-Reply-To: <20080619210617.GC6529@sigill.intra.peff.net>
On Thu, Jun 19, 2008 at 05:06:17PM -0400, Jeff King wrote:
> > the project's convention what to do with it. The side branch the patch
> > was developed on may be named "quick-hack", which would not have any
> > relevance to the final location of where that patch wants to be in.
>
> I suspect you would do better to look at branch.quick-hack.merge, so
> that you say "this was based on upstream's X", not "this is my
> quick-hack".
>
> But there are so many ways this could go wrong, since the patches you're
> formatting might not even have anything to do with the branch you're on.
Side note: if you have a particular workflow, it might make sense,
rather than using format-patch directly, to codify that workflow in
another script which says "ok, this is how I grab a branch and send it
upstream". And in that case, you could look up "here's where I branched
from" and feed it into the patch via format-patch's --subject-prefix
option.
-Peff
^ permalink raw reply
* Re: Including branch info in git format-patch
From: Jeff King @ 2008-06-19 21:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Mukund Sivaraman, git
In-Reply-To: <7vskv9rvrc.fsf@gitster.siamese.dyndns.org>
On Thu, Jun 19, 2008 at 01:54:15PM -0700, Junio C Hamano wrote:
> > You could potentially add a config option to put the branch name inside
> > the '[PATCH]' text. This text is generally stripped away before
> > applying, so it would still free up the receiver to apply on whatever
> > branch they wanted. I don't think it would make sense for git
> > development, since we typically use topic branches, so keeping it
> > configurable would make sense.
>
> People would work on individual patches on topic branches that are named
> differently from the branch on the other end anyway (the branch that
> corresonds to the other end will be used for local integration testing in
> such a setup), so I do not see much point in stating which local branch
> happened to have been checked out when the patch was generated, in the
> output.
I think that is totally dependent on the workflow, which is what I was
trying to say above. It really depends on how the patch-submitter
organizes his branches.
> the project's convention what to do with it. The side branch the patch
> was developed on may be named "quick-hack", which would not have any
> relevance to the final location of where that patch wants to be in.
I suspect you would do better to look at branch.quick-hack.merge, so
that you say "this was based on upstream's X", not "this is my
quick-hack".
But there are so many ways this could go wrong, since the patches you're
formatting might not even have anything to do with the branch you're on.
-Peff
^ permalink raw reply
* Re: [PATCH 2/2 v5] Git.pm: add test suite
From: Lea Wiemann @ 2008-06-19 20:55 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <m3lk11m9j7.fsf@localhost.localdomain>
Jakub Narebski wrote:
> Lea Wiemann <lewiemann@gmail.com> writes:
>> +use 5.006002; # Test::More was introduced in 5.6.2
>
> Isn't "use Test::More" enough, so this line is not strictly
> necessary?
I'd prefer to have a 'wrong Perl version' error instead of 'module not
found'. Also it's good to document what we support, to remind me that I
have to run it with perl5.6.
-- Lea
^ permalink raw reply
* Re: Including branch info in git format-patch
From: Junio C Hamano @ 2008-06-19 20:54 UTC (permalink / raw)
To: Jeff King; +Cc: Mukund Sivaraman, git
In-Reply-To: <20080619202843.GA6207@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> You could potentially add a config option to put the branch name inside
> the '[PATCH]' text. This text is generally stripped away before
> applying, so it would still free up the receiver to apply on whatever
> branch they wanted. I don't think it would make sense for git
> development, since we typically use topic branches, so keeping it
> configurable would make sense.
People would work on individual patches on topic branches that are named
differently from the branch on the other end anyway (the branch that
corresonds to the other end will be used for local integration testing in
such a setup), so I do not see much point in stating which local branch
happened to have been checked out when the patch was generated, in the
output.
Also, in git, there is no independent "branch history", so anybody who
says "this patch was taken from this branch" is either speaking very
loosely, or does not understand git's branching model at all, or bit of
both.
If you have a history of this shape:
(other cruft)
\
----o---o next
/
o---o---o---o master
/ /
---o---o---A
which "branch label" would you give to the format-patch output that shows
commit A? It may apply to both master and next, and it is really up to
the project's convention what to do with it. The side branch the patch
was developed on may be named "quick-hack", which would not have any
relevance to the final location of where that patch wants to be in.
^ permalink raw reply
* Re: [PATCH 2/2 v5] Git.pm: add test suite
From: Jakub Narebski @ 2008-06-19 20:53 UTC (permalink / raw)
To: Lea Wiemann; +Cc: git, Lea Wiemann
In-Reply-To: <1213907569-6393-1-git-send-email-LeWiemann@gmail.com>
Lea Wiemann <lewiemann@gmail.com> writes:
> Changes since v4:
>
> - Use 5.006002 (lowest possible version for Test::More).
[...]
> #!/usr/bin/perl
> use lib (split(/:/, $ENV{GITPERLLIB}));
>
> +use 5.006002; # Test::More was introduced in 5.6.2
Isn't "use Test::More" enough, so this line is not strictly
necessary?
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox