* [PATCH 1/3] Introduce "rev-list --stop-at=<commit>".
@ 2005-05-13 0:15 Junio C Hamano
2005-05-13 5:29 ` Petr Baudis
0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2005-05-13 0:15 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
Additional option, --stop-at=<commit>, is introduced. The
git-rev-list output stops just before showing the named commit.
This is based on Thoms Gleixner's patch but slightly reworked.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Documentation/git-rev-list.txt | 18 +++++++++++++++++-
rev-list.c | 20 ++++++++++++++++----
2 files changed, 33 insertions(+), 5 deletions(-)
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -9,7 +9,10 @@
SYNOPSIS
--------
-'git-rev-list' <commit>
+'git-rev-list' [--max-count=<number>]
+ [--max-age=<unixtime>]
+ [--min-age=<unixtime>]
+ [--stop-at=<commit>] <commit>
DESCRIPTION
-----------
@@ -17,6 +20,19 @@
given commit, taking ancestry relationship into account. This is
useful to produce human-readable log output.
+OPTIONS
+-------
+--max-count=<number>::
+ Stop after showing <number> commits.
+
+--max-age=<unixtime>::
+ Stop after showing commit made before <unixtime>.
+
+--min-age=<unixtime>::
+ Skip until commit made before <unixtime>.
+
+--stop-at=<commit>::
+ Stop just before showing <commit>.
Author
------
--- a/rev-list.c
+++ b/rev-list.c
@@ -1,12 +1,21 @@
#include "cache.h"
#include "commit.h"
+static const char *rev_list_usage =
+"usage: rev-list [OPTION] commit-id\n"
+" --max-count=nr\n"
+" --max-age=epoch\n"
+" --min-age=epoch\n"
+" --stop-at=commit\n";
+
int main(int argc, char **argv)
{
unsigned char sha1[20];
struct commit_list *list = NULL;
struct commit *commit;
char *commit_arg = NULL;
+ unsigned char stop_at[20];
+ int has_stop_at = 0;
int i;
unsigned long max_age = -1;
unsigned long min_age = -1;
@@ -21,16 +30,17 @@
max_age = atoi(arg + 10);
} else if (!strncmp(arg, "--min-age=", 10)) {
min_age = atoi(arg + 10);
+ } else if (!strncmp(arg, "--stop-at=", 10)) {
+ if (get_sha1(arg + 10, stop_at))
+ usage(rev_list_usage);
+ has_stop_at = 1;
} else {
commit_arg = arg;
}
}
if (!commit_arg || get_sha1(commit_arg, sha1))
- usage("usage: rev-list [OPTION] commit-id\n"
- " --max-count=nr\n"
- " --max-age=epoch\n"
- " --min-age=epoch\n");
+ usage(rev_list_usage);
commit = lookup_commit(sha1);
if (!commit || parse_commit(commit) < 0)
@@ -46,6 +56,8 @@
break;
if (max_count != -1 && !max_count--)
break;
+ if (has_stop_at && !memcmp(stop_at, commit->object.sha1, 20))
+ break;
printf("%s\n", sha1_to_hex(commit->object.sha1));
} while (list);
return 0;
------------------------------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] Introduce "rev-list --stop-at=<commit>".
2005-05-13 0:15 [PATCH 1/3] Introduce "rev-list --stop-at=<commit>" Junio C Hamano
@ 2005-05-13 5:29 ` Petr Baudis
2005-05-13 6:07 ` Noel Grandin
2005-05-13 7:36 ` Junio C Hamano
0 siblings, 2 replies; 4+ messages in thread
From: Petr Baudis @ 2005-05-13 5:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Dear diary, on Fri, May 13, 2005 at 02:15:15AM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> Additional option, --stop-at=<commit>, is introduced. The
> git-rev-list output stops just before showing the named commit.
>
> This is based on Thoms Gleixner's patch but slightly reworked.
>
> Signed-off-by: Junio C Hamano <junkio@cox.net>
Won't apply for now - as I already said in the relevant thread, this
makes no sense with the current git-rev-list output order, and even
encourages using it in wrong way. It is ok when the merges are reported
in a different way, but that's impossible without some repoid (I yet
have to catch up with that thread :-).
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] Introduce "rev-list --stop-at=<commit>".
2005-05-13 5:29 ` Petr Baudis
@ 2005-05-13 6:07 ` Noel Grandin
2005-05-13 7:36 ` Junio C Hamano
1 sibling, 0 replies; 4+ messages in thread
From: Noel Grandin @ 2005-05-13 6:07 UTC (permalink / raw)
To: Petr Baudis; +Cc: Junio C Hamano, git
[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]
Also, it should be called --stop-before given it's behaviour.
--stop-at implies that it includes the given commit.
Petr Baudis wrote:
>Dear diary, on Fri, May 13, 2005 at 02:15:15AM CEST, I got a letter
>where Junio C Hamano <junkio@cox.net> told me that...
>
>
>>Additional option, --stop-at=<commit>, is introduced. The
>>git-rev-list output stops just before showing the named commit.
>>
>>This is based on Thoms Gleixner's patch but slightly reworked.
>>
>>Signed-off-by: Junio C Hamano <junkio@cox.net>
>>
>>
>
>Won't apply for now - as I already said in the relevant thread, this
>makes no sense with the current git-rev-list output order, and even
>encourages using it in wrong way. It is ok when the merges are reported
>in a different way, but that's impossible without some repoid (I yet
>have to catch up with that thread :-).
>
>
>
NOTICE: Please note that this email, and the contents thereof,
are subject to the standard Peralex email disclaimer, which may
be found at: http://www.peralex.com/disclaimer.html
If you cannot access the disclaimer through the URL attached
and you wish to receive a copy thereof please send
an email to email@peralex.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] Introduce "rev-list --stop-at=<commit>".
2005-05-13 5:29 ` Petr Baudis
2005-05-13 6:07 ` Noel Grandin
@ 2005-05-13 7:36 ` Junio C Hamano
1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2005-05-13 7:36 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> Won't apply for now -
Consider it retracted. It does not make sense to me either.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-05-13 7:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-13 0:15 [PATCH 1/3] Introduce "rev-list --stop-at=<commit>" Junio C Hamano
2005-05-13 5:29 ` Petr Baudis
2005-05-13 6:07 ` Noel Grandin
2005-05-13 7:36 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox