git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: Brice Goglin <bgoglin@debian.org>,
	557477-forwarded@bugs.debian.org, 557477@bugs.debian.org,
	git@vger.kernel.org, Alex Vandiver <alex@chmrr.net>,
	Pedro Melo <melo@simplicidade.org>, Sam Vilain <sam@vilain.net>
Subject: Bug#557477: git-svn: git svn dcommit doesn't handle network failure
Date: Sat, 9 Jan 2010 01:57:43 -0600	[thread overview]
Message-ID: <20100109075743.GA3377@progeny.tock> (raw)
In-Reply-To: <20100109021347.GA26520@dcvr.yhbt.net>

Eric Wong wrote:

> I agree that error recovery for dcommit sucks right now.
> 
> I think Brice's idea (creating a temporary branch to dcommit from)
> is easier to implement and less likely to break than automatically
> unapplying patches.

Sounds sane to me.  Probably that temporary branch could just be
a detached HEAD.

Current dcommit:

 diff-index --quiet HEAD || carp "Cannot dcommit with a dirty index"
 if head ne 'HEAD':
	save the old HEAD
	check out the head
 find svn upstream
 decide what commits to push (linearize_history)
 for each commit d to push:
	commit diff from d~ to d to the remote repository
		(this involves applying the diff locally?)
	remember parents
	fetch remote revision, using remembered parents for commit

	unless args include --no-rebase:
		rebase the current HEAD against fetched revision
			(or reset if there are no changes)
		update the list of commits to push
 if head ne 'HEAD':
	let the user know the branch or commit id for the finished dcommit
	check out the old head again

If I understand you correctly, before finding the svn upstream,
dcommit would save the HEAD ref name (if any) and detach the HEAD;
after pushing the relevant commits, update that ref and reattach the
HEAD.

If pushing fails early, what should git-svn do?  Leave the HEAD
detached, with a message suggesting to return to the old ref?  Check
out the old ref, with a message suggesting to 'git svn rebase' and try
again?  Do the 'git svn rebase' automatically?

I guess the safest option is the first one.  That would at least be a
starting point for experimenting with more friendly behaviors.

I should also mention that there seems to be a little race here: if
git-svn dies before (or while) fetching the newly commited revision,
when it is fetched later it will have the wrong parents.

Jonathan

      reply	other threads:[~2010-01-09  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091122112434.29914.59452.reportbug@localhost.localdomain>
2010-01-09  1:00 ` git-svn: git svn dcommit doesn't handle network failure Jonathan Nieder
2010-01-09  2:13   ` Eric Wong
2010-01-09  7:57     ` Jonathan Nieder [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=20100109075743.GA3377@progeny.tock \
    --to=jrnieder@gmail.com \
    --cc=557477-forwarded@bugs.debian.org \
    --cc=557477@bugs.debian.org \
    --cc=alex@chmrr.net \
    --cc=bgoglin@debian.org \
    --cc=git@vger.kernel.org \
    --cc=melo@simplicidade.org \
    --cc=normalperson@yhbt.net \
    --cc=sam@vilain.net \
    /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).