* [PATCH] [TOPGIT] make tg remote idempotent
@ 2009-01-14 21:27 Uwe Kleine-König
2009-01-14 21:27 ` [PATCH] [TOPGIT] make creating a commit from a topgit branch a function Uwe Kleine-König
2009-01-21 11:06 ` [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
0 siblings, 2 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2009-01-14 21:27 UTC (permalink / raw)
To: git; +Cc: martin f. krafft, Petr Baudis
Before this patch each call to tg remote added three config entries
no matter if they already existed. After some time my .git/config was
crowded.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
tg-remote.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tg-remote.sh b/tg-remote.sh
index c3e8bd3..7f7a1b0 100644
--- a/tg-remote.sh
+++ b/tg-remote.sh
@@ -27,9 +27,9 @@ git config "remote.$name.url" >/dev/null || die "unknown remote '$name'"
## Configure the remote
-git config --add "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*"
-git config --add "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*"
-git config --add "remote.$name.push" "+refs/heads/*:refs/heads/*"
+git config --replace-all "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*" "+refs/top-bases/*:refs/remotes/$name/top-bases/*"
+git config --replace-all "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*" "+refs/top-bases/*:refs/top-bases/*"
+git config --replace-all "remote.$name.push" "+refs/heads/*:refs/heads/*" "+refs/heads/*:refs/heads/*"
info "Remote $name can now follow TopGit topic branches."
if [ -z "$populate" ]; then
--
1.5.6.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] [TOPGIT] make creating a commit from a topgit branch a function
2009-01-14 21:27 [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
@ 2009-01-14 21:27 ` Uwe Kleine-König
2009-01-21 3:19 ` martin f krafft
2009-01-21 11:06 ` [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
1 sibling, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-01-14 21:27 UTC (permalink / raw)
To: git; +Cc: martin f. krafft, Petr Baudis
This helps avoiding code duplication for the next commit.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
tg-export.sh | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/tg-export.sh b/tg-export.sh
index 9e6940f..dea24d9 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -71,14 +71,11 @@ pretty_tree()
git write-tree)
}
-# collapsed_commit NAME
-# Produce a collapsed commit of branch NAME.
-collapsed_commit()
+create_tg_commit()
{
name="$1"
-
- rm -f "$playground/^pre" "$playground/^post"
- >"$playground/^body"
+ tree="$2"
+ parent="$3"
# Get commit message and authorship information
git cat-file blob "$name:.topmsg" | git mailinfo "$playground/^msg" /dev/null > "$playground/^info"
@@ -92,6 +89,20 @@ collapsed_commit()
test -n "$GIT_AUTHOR_EMAIL" && export GIT_AUTHOR_EMAIL
test -n "$GIT_AUTHOR_DATE" && export GIT_AUTHOR_DATE
+ (printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
+ git stripspace |
+ git commit-tree "$tree" -p "$parent"
+}
+
+# collapsed_commit NAME
+# Produce a collapsed commit of branch NAME.
+collapsed_commit()
+{
+ name="$1"
+
+ rm -f "$playground/^pre" "$playground/^post"
+ >"$playground/^body"
+
# Determine parent
parent="$(cut -f 1 "$playground/$name^parents")"
if [ "$(cat "$playground/$name^parents" | wc -l)" -gt 1 ]; then
@@ -107,9 +118,7 @@ collapsed_commit()
if branch_empty "$name"; then
echo "$parent";
else
- (printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
- git stripspace |
- git commit-tree "$(pretty_tree "$name")" -p "$parent"
+ create_tg_commit "$name" "$(pretty_tree $name)" "$parent"
fi;
echo "$name" >>"$playground/^ticker"
--
1.5.6.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] [TOPGIT] make creating a commit from a topgit branch a function
2009-01-14 21:27 ` [PATCH] [TOPGIT] make creating a commit from a topgit branch a function Uwe Kleine-König
@ 2009-01-21 3:19 ` martin f krafft
2009-01-21 10:16 ` Uwe Kleine-König
0 siblings, 1 reply; 8+ messages in thread
From: martin f krafft @ 2009-01-21 3:19 UTC (permalink / raw)
To: Uwe Kleine-König, git, Petr Baudis
[-- Attachment #1: Type: text/plain, Size: 564 bytes --]
also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2009.01.15.0827 +1100]:
> This helps avoiding code duplication for the next commit.
What's the "next commit"?
--
.''`. martin f. krafft <madduck@d.o> Related projects:
: :' : proud Debian developer http://debiansystem.info
`. `'` http://people.debian.org/~madduck http://vcs-pkg.org
`- Debian - when you have better things to do than fixing systems
i'd rather be riding a high speed tractor
with a beer on my lap,
and a six pack of girls next to me.
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [TOPGIT] make creating a commit from a topgit branch a function
2009-01-21 3:19 ` martin f krafft
@ 2009-01-21 10:16 ` Uwe Kleine-König
2009-01-22 0:13 ` martin f krafft
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-01-21 10:16 UTC (permalink / raw)
To: martin f krafft; +Cc: git, Petr Baudis
On Wed, Jan 21, 2009 at 02:19:13PM +1100, martin f krafft wrote:
> also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2009.01.15.0827 +1100]:
> > This helps avoiding code duplication for the next commit.
>
> What's the "next commit"?
oh, sorry. I intended to post my patch that implements `tg export
--linearize`, but then found a bug and so didn't send it.
You can find it in my pu branch at
git://git.pengutronix.de/git/ukl/topgit.git pu
. It's not yet ready for general use, but I look forward to any
constructive feedback.
Best regards and thanks for the reminder,
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Strasse 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [TOPGIT] make creating a commit from a topgit branch a function
2009-01-21 10:16 ` Uwe Kleine-König
@ 2009-01-22 0:13 ` martin f krafft
0 siblings, 0 replies; 8+ messages in thread
From: martin f krafft @ 2009-01-22 0:13 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: git, Petr Baudis
[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]
also sprach Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [2009.01.21.2116 +1100]:
> > What's the "next commit"?
> oh, sorry. I intended to post my patch that implements `tg export
> --linearize`, but then found a bug and so didn't send it.
>
> You can find it in my pu branch at
>
> git://git.pengutronix.de/git/ukl/topgit.git pu
>
> . It's not yet ready for general use, but I look forward to any
> constructive feedback.
It'll be a while until I can look into this. Until I do, I will only
pull in f4fa614, and we'll pull ae3fe45 when your linearizing patch
is ready.
--
.''`. martin f. krafft <madduck@d.o> Related projects:
: :' : proud Debian developer http://debiansystem.info
`. `'` http://people.debian.org/~madduck http://vcs-pkg.org
`- Debian - when you have better things to do than fixing systems
"you grabbed my hand and we fell into it,
like a daydream - or a fever."
-- godspeed you black emperor!
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [TOPGIT] make tg remote idempotent
2009-01-14 21:27 [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
2009-01-14 21:27 ` [PATCH] [TOPGIT] make creating a commit from a topgit branch a function Uwe Kleine-König
@ 2009-01-21 11:06 ` Uwe Kleine-König
2009-01-21 14:31 ` martin f krafft
1 sibling, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-01-21 11:06 UTC (permalink / raw)
To: git; +Cc: martin f. krafft, Petr Baudis
Hello,
On Wed, Jan 14, 2009 at 10:27:22PM +0100, Uwe Kleine-König wrote:
> -git config --add "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*"
> -git config --add "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*"
> -git config --add "remote.$name.push" "+refs/heads/*:refs/heads/*"
> +git config --replace-all "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*" "+refs/top-bases/*:refs/remotes/$name/top-bases/*"
> +git config --replace-all "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*" "+refs/top-bases/*:refs/top-bases/*"
> +git config --replace-all "remote.$name.push" "+refs/heads/*:refs/heads/*" "+refs/heads/*:refs/heads/*"
It seems I sent an old version of this patch. Actually in the last
argument '+' and '*' have to be quoted to work.
I fixed this in my repo. Should I resend the fixed patch?
Best regards
Uwe
^ permalink raw reply [flat|nested] 8+ messages in thread
* topgit patches
@ 2009-02-25 19:58 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
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-02-25 19:58 UTC (permalink / raw)
To: git; +Cc: Petr Baudis, martin f. krafft
Hello,
The following changes since commit 8c77c342166ddc6ecb3840628d89ddc5bb6b043b:
Kirill Smelkov (1):
tg-completion: complete options for `tg remote`
are available in the git repository at:
git://git.pengutronix.de/git/ukl/topgit.git pu
Uwe Kleine-König (5):
[TOPGIT] limit rev-list in branch_contains to a single rev
[TOPGIT] allow working with annihilated branches
[TOPGIT] make tg remote idempotent
[TOPGIT] make creating a commit from a topgit branch a function
[TOPGIT] implement linearize export method
tg-export.sh | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
tg-remote.sh | 6 ++--
tg-summary.sh | 11 ++++++-
tg.sh | 19 ++++++++++-
4 files changed, 113 insertions(+), 17 deletions(-)
I consider the first three as ready to pull (they form my master branch
at the repo above). The fourth commit is just preparing the fifth. The
fifth commit implements a new export method that I use often. The error
handling isn't well tested, just because I don't usually run into merge
conflicts in my series :-)
I look forward to comments, especially for the last commit.
For review purposes I send the patches as a reply to this mail.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] [TOPGIT] limit rev-list in branch_contains to a single rev
2009-02-25 19:58 topgit patches Uwe Kleine-König
@ 2009-02-25 20:03 ` Uwe Kleine-König
2009-02-25 20:03 ` [PATCH] [TOPGIT] allow working with annihilated branches Uwe Kleine-König
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-02-25 20:03 UTC (permalink / raw)
To: git
This eases reading of debug output using sh -x and probably helps
performance, too.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
tg.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tg.sh b/tg.sh
index 8c23d26..ccb40cd 100644
--- a/tg.sh
+++ b/tg.sh
@@ -77,7 +77,7 @@ measure_branch()
# Whether B1 is a superset of B2.
branch_contains()
{
- [ -z "$(git rev-list ^"$1" "$2" --)" ]
+ [ -z "$(git rev-list --max-count=1 ^"$1" "$2" --)" ]
}
# ref_exists REF
--
1.5.6.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] [TOPGIT] allow working with annihilated branches
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
2009-02-25 20:03 ` [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Kleine-König @ 2009-02-25 20:03 UTC (permalink / raw)
To: git
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] [TOPGIT] make tg remote idempotent
2009-02-25 20:03 ` [PATCH] [TOPGIT] allow working with annihilated branches Uwe Kleine-König
@ 2009-02-25 20:03 ` Uwe Kleine-König
0 siblings, 0 replies; 8+ messages in thread
From: Uwe Kleine-König @ 2009-02-25 20:03 UTC (permalink / raw)
To: git
Before this patch each call to tg remote added three config entries
no matter if they already existed. After some time my .git/config was
crowded.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
tg-remote.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tg-remote.sh b/tg-remote.sh
index c3e8bd3..3a40081 100644
--- a/tg-remote.sh
+++ b/tg-remote.sh
@@ -27,9 +27,9 @@ git config "remote.$name.url" >/dev/null || die "unknown remote '$name'"
## Configure the remote
-git config --add "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*"
-git config --add "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*"
-git config --add "remote.$name.push" "+refs/heads/*:refs/heads/*"
+git config --replace-all "remote.$name.fetch" "+refs/top-bases/*:refs/remotes/$name/top-bases/*" "\\+refs/top-bases/\\*:refs/remotes/$name/top-bases/\\*"
+git config --replace-all "remote.$name.push" "+refs/top-bases/*:refs/top-bases/*" "\\+refs/top-bases/\\*:refs/top-bases/\\*"
+git config --replace-all "remote.$name.push" "+refs/heads/*:refs/heads/*" "\\+refs/heads/\\*:refs/heads/\\*"
info "Remote $name can now follow TopGit topic branches."
if [ -z "$populate" ]; then
--
1.5.6.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-02-25 20:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 21:27 [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
2009-01-14 21:27 ` [PATCH] [TOPGIT] make creating a commit from a topgit branch a function Uwe Kleine-König
2009-01-21 3:19 ` martin f krafft
2009-01-21 10:16 ` Uwe Kleine-König
2009-01-22 0:13 ` martin f krafft
2009-01-21 11:06 ` [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
2009-01-21 14:31 ` martin f krafft
-- strict thread matches above, loose matches on Subject: below --
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 ` [PATCH] [TOPGIT] allow working with annihilated branches Uwe Kleine-König
2009-02-25 20:03 ` [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
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).