All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Nieuwenhuizen <janneke-list@xs4all.nl>
To: git@vger.kernel.org
Subject: TOPGIT: [PATCH] tg create: add --force option to resolve merge dependencies.
Date: Tue, 12 Aug 2008 15:01:46 +0200	[thread overview]
Message-ID: <1218546106.7264.11.camel@heerbeest> (raw)

I have been trying to adapt my ooo-build export to topgit
instead of plain git and ran into the (documented and
expected) merge conflicts in .top*.

After unsuccesfully trying to script around it in my
gob git-export script, I found that this simple tg-create.sh
seems to work for me: just remove any <<<,===,>>> from
.topdeps and simply generate the new .topmgs later.

What do you think?  Is this naive way of 'auto' resolving
dependency problems doing the right thing?

BTW: thanks for creating topgit, it looks like just what
     I was missing.

-- janneke

Signed-off-by: Jan Nieuwenhuizen <janneke@gnu.org>
---
 tg-create.sh |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/tg-create.sh b/tg-create.sh
index 6cce7ed..0c83460 100644
--- a/tg-create.sh
+++ b/tg-create.sh
@@ -14,6 +14,8 @@ name=
 while [ -n "$1" ]; do
 	arg="$1"; shift
 	case "$arg" in
+	--force)
+		force=1;;
 	-*)
 		echo "Usage: tg create NAME [DEPS...]" >&2
 		exit 1;;
@@ -82,6 +84,11 @@ while [ -n "$merge" ]; do
 	info "Merging $name base with $branch..."
 
 	if ! git merge "$branch"; then
+	    if test "$force" = "1"; then
+                mv .topdeps .topdeps~ && grep -Ev '(<|>|=){7}' .topdeps~ > .topdeps && rm .topdeps~
+                git add .topdeps .topmsg
+                git commit -am 'Auto-resolve topgit .top* merge failure.'
+	    else
 		info "Please commit merge resolution and call: tg create"
 		info "It is also safe to abort this operation using \`git reset --hard\`"
 		info "but please remember you are on the base branch now;"
@@ -89,6 +96,7 @@ while [ -n "$merge" ]; do
 		echo "$deps" >"$git_dir/top-deps"
 		echo "$merge" >"$git_dir/top-merge"
 		exit 2
+	    fi
 	fi
 done
 
-- 
1.6.0.rc0.44.g67270


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org

             reply	other threads:[~2008-08-12 13:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-12 13:01 Jan Nieuwenhuizen [this message]
2008-08-12 13:38 ` TOPGIT: [PATCH] tg create: add --force option to resolve merge dependencies Petr Baudis
2008-08-12 15:02   ` Jan Nieuwenhuizen
2008-08-12 17:55     ` Bert Wesarg

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=1218546106.7264.11.camel@heerbeest \
    --to=janneke-list@xs4all.nl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.