git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Petr Baudis <pasky@suse.cz>,
	git@vger.kernel.org, martin f krafft <madduck@debian.org>,
	Marc Weber <marco-oweber@gmx.de>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [TopGit PATCH] tg-push: prevent multiple occurences of branches
Date: Wed, 27 May 2009 09:40:34 +0200	[thread overview]
Message-ID: <36ca99e90905270040x2ac8e739j99411d61e8ef2689@mail.gmail.com> (raw)
In-Reply-To: <20090527072100.GA13559@pengutronix.de>

2009/5/27 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> Hi Bert,
Moin Uwe,

>
> On Tue, May 26, 2009 at 11:37:00PM +0200, Bert Wesarg wrote:
>> So, I finally tried tg-push and got a lot of warnings and errors:
>>
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>> warning, no base found top-bases/master
>>
>>
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/master
>> error: Ref refs/heads/bw/log is at a16df35cc7009b36f6f71717ae3d9a3dc29987da but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/heads/bw/log
>> error: Ref refs/top-bases/bw/log is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000
>> error: failed to lock refs/top-bases/bw/log
>>
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] master -> master (failed to lock)
>>  ! [remote rejected] bw/log -> bw/log (failed to lock)
>>  ! [remote rejected] refs/top-bases/bw/log -> refs/top-bases/bw/log (failed to lock)
> hhm, does this happen because
>
>        git push $remote master master master master
Exactly.

>
> tries to lock master four times?  I'd think this is something that needs
> fixing in git-core.
Cc'd Junio. And Junio, you can stop reading now.

>
>> Also the result was ok this output is defintive not ok.
>>
>> To prevent multiple occurences of the same branchname we maintain these in a
>> file.
>>
>> In push_branch ref_exists was called, which is redundant because _dep_is_tgish
>> tells us exactly this.
> ... what about breaking this out?
By your command.

>
>> ---
>>  tg-push.sh |   48 +++++++++++++++++++++++++++++-------------------
>>  1 files changed, 29 insertions(+), 19 deletions(-)
>>
>> diff --git a/tg-push.sh b/tg-push.sh
>> index 8d09a02..c813927 100644
>> --- a/tg-push.sh
>> +++ b/tg-push.sh
>> @@ -45,31 +45,41 @@ for name in $branches; do
>>       ref_exists "$name" || die "detached HEAD? Can't push $name"
>>  done
>>
>> +_listfile="$(mktemp -t tg-push-listfile.XXXXXX)"
>> +trap "rm -f \"$_listfile\"" 0
>> +
>> +# prevent multiple occurrences of the same branch
>> +add_to_list()
>> +{
>> +     fgrep -qx "$1" "$_listfile" ||
>> +             echo "$1" >> "$_listfile"
>> +}
> This has complexity O(n**2) for n calls (I think).  Just writing then to
> the list and doing sort -u afterwards only has O(n log n) (for a
> reasonable implementation of sort).
Ahh, that takes a while, but yes. I thought I need to sort each time I
put a new branch in this file.

>
>>  push_branch()
>>  {
>>       # if so desired omit non tgish deps
>>       $tgish_deps_only && [ -z "$_dep_is_tgish" ] && return 0
>>
>> -     echo "$_dep"
> what about $tgish_deps_only?
Hmm, I think I have not changed the semantics here. I replace this
line with 'add_to_list "$_dep"'.

>> -     local base="top-bases/$_dep"
>> -     if ref_exists "$base"; then
>> -             echo "top-bases/$_dep"
>> -     else
>> -             echo "warning, no base found $base" 1>&2
>> -     fi
>> +     add_to_list "$_dep"
>> +     [ -z "$_dep_is_tgish" ] ||
>> +             add_to_list "top-bases/$_dep"
>
Bert

> Best regards
> Uwe

      reply	other threads:[~2009-05-27  7:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 21:37 [TopGit PATCH] tg-push: prevent multiple occurences of branches Bert Wesarg
2009-05-27  7:21 ` Uwe Kleine-König
2009-05-27  7:40   ` Bert Wesarg [this message]

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=36ca99e90905270040x2ac8e739j99411d61e8ef2689@mail.gmail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madduck@debian.org \
    --cc=marco-oweber@gmx.de \
    --cc=pasky@suse.cz \
    --cc=u.kleine-koenig@pengutronix.de \
    /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).