{"thread":{"id":"19553","subject":"Re: [TopGit PATCH v2 2/3] tg-push: prevent multiple occurences of branches","startedAt":"2009-05-27T08:16:22Z","lastAt":"2009-05-28T07:24:26Z","messageCount":5,"participants":["Uwe Kleine-König","Bert Wesarg"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"299102","messageId":"1243412182-24126-1-git-send-email-bert.wesarg@googlemail.com","threadId":"19553","inReplyTo":null,"subject":"[PATCH TopGit 1/3] tg-push: remove useless warning of missing bases for non-tgish branches","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-05-27T08:16:22Z","receivedAt":"2009-05-27T08:16:22Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n tg-push.sh |    6 +-----\n 1 files changed, 1 insertions(+), 5 deletions(-)\n\ndiff --git a/tg-push.sh b/tg-push.sh\nindex 8d09a02..40849ae 100644\n--- a/tg-push.sh\n+++ b/tg-push.sh\n@@ -51,12 +51,8 @@ push_branch()\n \t$tgish_deps_only && [ -z \"$_dep_is_tgish\" ] && return 0\n \n \techo \"$_dep\"\n-\tlocal base=\"top-bases/$_dep\"\n-\tif ref_exists \"$base\"; then\n+\t[ -z \"$_dep_is_tgish\" ] ||\n \t\techo \"top-bases/$_dep\"\n-\telse\n-\t\techo \"warning, no base found $base\" 1>&2\n-\tfi\n }\n \n for name in $branches; do\n-- \ntg: (b725fc9..) bw/push-remove-useless-warning (depends on: master)\n"},{"id":"299103","messageId":"1243412195-29841-1-git-send-email-bert.wesarg@googlemail.com","threadId":"19553","inReplyTo":"1243412182-24126-1-git-send-email-bert.wesarg@googlemail.com","subject":"[TopGit PATCH v2 2/3] tg-push: prevent multiple occurences of branches","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-05-27T08:16:35Z","receivedAt":"2009-05-27T08:16:35Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"So, I finally tried the tg-push and got a lot of warnings and errors:\n\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\nwarning, no base found top-bases/master\n\n\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/master is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/master\nerror: Ref refs/heads/bw/log is at a16df35cc7009b36f6f71717ae3d9a3dc29987da but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/heads/bw/log\nerror: Ref refs/top-bases/bw/log is at b725fc951a37854fc65945ac5bcab3bc61ccbd94 but expected 0000000000000000000000000000000000000000\nerror: failed to lock refs/top-bases/bw/log\n\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] master -> master (failed to lock)\n ! [remote rejected] bw/log -> bw/log (failed to lock)\n ! [remote rejected] refs/top-bases/bw/log -> refs/top-bases/bw/log (failed to lock)\n\nAlso the result was ok this output is defintive not ok.\n\nTo prevent multiple occurences of the same branchname we sort -u these at the\nend, as suggested by Uwe.\n\nRegards,\nBert\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n tg-push.sh |   33 +++++++++++++++++++--------------\n 1 files changed, 19 insertions(+), 14 deletions(-)\n\ndiff --git a/tg-push.sh b/tg-push.sh\nindex 40849ae..8e1b43f 100644\n--- a/tg-push.sh\n+++ b/tg-push.sh\n@@ -45,27 +45,32 @@ for name in $branches; do\n \tref_exists \"$name\" || die \"detached HEAD? Can't push $name\"\n done\n \n+_listfile=\"$(mktemp -t tg-push-listfile.XXXXXX)\"\n+trap \"rm -f \\\"$_listfile\\\"\" 0\n+\n push_branch()\n {\n \t# if so desired omit non tgish deps\n \t$tgish_deps_only && [ -z \"$_dep_is_tgish\" ] && return 0\n \n-\techo \"$_dep\"\n+\techo \"$_dep\" >> \"$_listfile\"\n \t[ -z \"$_dep_is_tgish\" ] ||\n-\t\techo \"top-bases/$_dep\"\n+\t\techo \"top-bases/$_dep\" >> \"$_listfile\"\n }\n \n for name in $branches; do\n-\tlist=\"$(\n-\t\t# deps\n-\t\tif $recurse_deps; then\n-\t\t\tno_remotes=1 recurse_deps push_branch \"$name\"\n-\t\tfi\n-\t\t# current branch\n-\t\t_dep=\"$name\"\n-\t\t_dep_is_tgish=1\n-\t\tpush_branch \"$name\"\n-\t)\"\n-\techo \"pushing:\"; echo $list\n-\tgit push $dry_run \"$remote\" $list\n+\t# current branch\n+\t# re-use push_branch, which expects some pre-defined variables\n+\t_dep=\"$name\"\n+\t_dep_is_tgish=1\n+\tref_exists \"top-bases/$_dep\" ||\n+\t\t_dep_is_tgish=\n+\tpush_branch \"$name\"\n+\n+\t# deps\n+\t$recurse_deps &&\n+\t\tno_remotes=1 recurse_deps push_branch \"$name\"\n+\n+\t# remove multiple occurrences of the same branch\n+\tsort -u \"$_listfile\" | xargs git push $dry_run \"$remote\"\n done\n-- \ntg: (8f4fb90..) bw/push-fixes (depends on: bw/push-remove-useless-warning)\n"},{"id":"299104","messageId":"1243412221-2844-1-git-send-email-bert.wesarg@googlemail.com","threadId":"19553","inReplyTo":"1243412195-29841-1-git-send-email-bert.wesarg@googlemail.com","subject":"[TopGit PATCH v2 3/3] tg-push: handle non-tgish branches","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-05-27T08:17:01Z","receivedAt":"2009-05-27T08:17:01Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"tg push dies if you give it a non-tgish branch:\n\n$ tg push -r push-test master\nfatal: Not a valid object name refs/top-bases/master\nfatal: ambiguous argument '^{tree}': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions\nfatal: Not a valid object name master:.topdeps\n\nFix this.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n tg-push.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/tg-push.sh b/tg-push.sh\nindex 8e1b43f..cd208a0 100644\n--- a/tg-push.sh\n+++ b/tg-push.sh\n@@ -67,8 +67,8 @@ for name in $branches; do\n \t\t_dep_is_tgish=\n \tpush_branch \"$name\"\n \n-\t# deps\n-\t$recurse_deps &&\n+\t# deps but only if branch is tgish\n+\t$recurse_deps && [ -n \"$_dep_is_tgish\" ] &&\n \t\tno_remotes=1 recurse_deps push_branch \"$name\"\n \n \t# remove multiple occurrences of the same branch\n-- \ntg: (cbca164..) bw/push-fixes-2 (depends on: bw/push-fixes)\n"},{"id":"114897","messageId":"20090528072321.GC12151@pengutronix.de","threadId":"19553","inReplyTo":"1243412195-29841-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH v2 2/3] tg-push: prevent multiple occurences of branches","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-05-28T07:23:21Z","receivedAt":"2009-05-28T07:23:21Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hi Bert,\n\nI didn't try, but looks OK.  I'd do some commit log massaging, but I can\ndo that while commiting.  I just wait for 1/3.\n\nThanks\nUwe\n\n-- \nPengutronix e.K.                              | Uwe Kleine-König            |\nIndustrial Linux Solutions                    | http://www.pengutronix.de/  |\n"},{"id":"114898","messageId":"20090528072426.GD12151@pengutronix.de","threadId":"19553","inReplyTo":"1243412221-2844-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH v2 3/3] tg-push: handle non-tgish branches","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-05-28T07:24:26Z","receivedAt":"2009-05-28T07:24:26Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hi,\n\n> -\t# deps\n> -\t$recurse_deps &&\n> +\t# deps but only if branch is tgish\n> +\t$recurse_deps && [ -n \"$_dep_is_tgish\" ] &&\n>  \t\tno_remotes=1 recurse_deps push_branch \"$name\"\nOK, wait for 1-2/3.\n\nBest regards\nUwe\n\n-- \nPengutronix e.K.                              | Uwe Kleine-König            |\nIndustrial Linux Solutions                    | http://www.pengutronix.de/  |\n"}]}