From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: git@vger.kernel.org
Subject: [PATCH] [TOPGIT] allow working with annihilated branches
Date: Wed, 25 Feb 2009 21:03:57 +0100 [thread overview]
Message-ID: <1235592240-12616-2-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <1235592240-12616-1-git-send-email-u.kleine-koenig@pengutronix.de>
If you decide that you want to drop a patch, you can just merge in its
base with strategy "theirs". Then you have base=topic and so no .top*
files any more. This patch fixes tg summary and the helper function
recurse_deps() to handle these annihilated branches as if they don't
exist and don't show up in .topdeps files.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
tg-summary.sh | 11 ++++++++++-
tg.sh | 17 ++++++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/tg-summary.sh b/tg-summary.sh
index 842d95a..50ee883 100644
--- a/tg-summary.sh
+++ b/tg-summary.sh
@@ -53,13 +53,22 @@ fi
git for-each-ref refs/top-bases |
while read rev type ref; do
name="${ref#refs/top-bases/}"
+ if branch_annihilated "$name"; then
+ continue;
+ fi;
+
if [ -n "$terse" ]; then
echo "$name"
continue
fi
if [ -n "$graphviz" ]; then
git cat-file blob "$name:.topdeps" | while read dep; do
- echo "\"$name\" -> \"$dep\";"
+ dep_is_tgish=true
+ ref_exists "refs/top-bases/$dep" ||
+ dep_is_tgish=false
+ if ! "$dep_is_tgish" || ! branch_annihilated $dep; then
+ echo "\"$name\" -> \"$dep\";"
+ fi
done
continue
fi
diff --git a/tg.sh b/tg.sh
index ccb40cd..5bb2d0c 100644
--- a/tg.sh
+++ b/tg.sh
@@ -94,6 +94,16 @@ has_remote()
[ -n "$base_remote" ] && ref_exists "remotes/$base_remote/$1"
}
+branch_annihilated()
+{
+ _name="$1";
+
+ # use the merge base in case the base is ahead.
+ mb="$(git merge-base "refs/top-bases/$_name" "$_name")";
+
+ test "$(git rev-parse "$mb^{tree}")" = "$(git rev-parse "$_name^{tree}")";
+}
+
# recurse_deps CMD NAME [BRANCHPATH...]
# Recursively eval CMD on all dependencies of NAME.
# CMD can refer to $_name for queried branch name,
@@ -116,7 +126,12 @@ recurse_deps()
if has_remote "top-bases/$_name"; then
echo "refs/remotes/$base_remote/top-bases/$_name" >>"$_depsfile"
fi
- git cat-file blob "$_name:.topdeps" >>"$_depsfile"
+
+ # if the branch was annihilated, there exists no .topdeps file
+ if ! branch_annihilated "$_name"; then
+ #TODO: handle nonexisting .topdeps?
+ git cat-file blob "$_name:.topdeps" >>"$_depsfile";
+ fi;
_ret=0
while read _dep; do
--
1.5.6.5
next prev parent reply other threads:[~2009-02-25 20:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 19:58 topgit patches Uwe Kleine-König
2009-02-25 20:03 ` [PATCH] [TOPGIT] limit rev-list in branch_contains to a single rev Uwe Kleine-König
2009-02-25 20:03 ` Uwe Kleine-König [this message]
2009-02-25 20:03 ` [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
2009-02-25 20:03 ` [PATCH] [TOPGIT] make creating a commit from a topgit branch a function Uwe Kleine-König
2009-02-25 20:04 ` [PATCH] [TOPGIT] implement linearize export method Uwe Kleine-König
2009-02-25 21:23 ` topgit patches Petr Baudis
2009-02-25 23:15 ` Uwe Kleine-König
2009-02-25 23:22 ` Petr Baudis
2009-02-26 13:47 ` Uwe Kleine-König
2009-02-26 6:06 ` martin f krafft
2009-02-26 14:15 ` Uwe Kleine-König
2009-02-27 12:37 ` martin f krafft
2009-02-27 19:42 ` Uwe Kleine-König
2009-03-02 16:26 ` Uwe Kleine-König
2009-03-03 7:54 ` martin f krafft
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1235592240-12616-2-git-send-email-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).