提交 a5aa930d 编写于 作者: U Uwe Kleine-König 提交者: Junio C Hamano

rev-list: add --branches, --tags and --remotes

These flags are already known to rev-parse and have the same meaning.

This patch allows to run gitk as follows:

	gitk --branches --not --remotes

to show only your local work.
Signed-off-by: NUwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 419e3833
...@@ -20,6 +20,9 @@ SYNOPSIS ...@@ -20,6 +20,9 @@ SYNOPSIS
[ \--full-history ] [ \--full-history ]
[ \--not ] [ \--not ]
[ \--all ] [ \--all ]
[ \--branches ]
[ \--tags ]
[ \--remotes ]
[ \--stdin ] [ \--stdin ]
[ \--quiet ] [ \--quiet ]
[ \--topo-order ] [ \--topo-order ]
......
...@@ -25,6 +25,9 @@ static const char rev_list_usage[] = ...@@ -25,6 +25,9 @@ static const char rev_list_usage[] =
" --no-merges\n" " --no-merges\n"
" --remove-empty\n" " --remove-empty\n"
" --all\n" " --all\n"
" --branches\n"
" --tags\n"
" --remotes\n"
" --stdin\n" " --stdin\n"
" --quiet\n" " --quiet\n"
" ordering output:\n" " ordering output:\n"
......
...@@ -633,12 +633,13 @@ static int handle_one_ref(const char *path, const unsigned char *sha1, int flag, ...@@ -633,12 +633,13 @@ static int handle_one_ref(const char *path, const unsigned char *sha1, int flag,
return 0; return 0;
} }
static void handle_all(struct rev_info *revs, unsigned flags) static void handle_refs(struct rev_info *revs, unsigned flags,
int (*for_each)(each_ref_fn, void *))
{ {
struct all_refs_cb cb; struct all_refs_cb cb;
cb.all_revs = revs; cb.all_revs = revs;
cb.all_flags = flags; cb.all_flags = flags;
for_each_ref(handle_one_ref, &cb); for_each(handle_one_ref, &cb);
} }
static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data) static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
...@@ -1015,7 +1016,19 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch ...@@ -1015,7 +1016,19 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
continue; continue;
} }
if (!strcmp(arg, "--all")) { if (!strcmp(arg, "--all")) {
handle_all(revs, flags); handle_refs(revs, flags, for_each_ref);
continue;
}
if (!strcmp(arg, "--branches")) {
handle_refs(revs, flags, for_each_branch_ref);
continue;
}
if (!strcmp(arg, "--tags")) {
handle_refs(revs, flags, for_each_tag_ref);
continue;
}
if (!strcmp(arg, "--remotes")) {
handle_refs(revs, flags, for_each_remote_ref);
continue; continue;
} }
if (!strcmp(arg, "--first-parent")) { if (!strcmp(arg, "--first-parent")) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册