git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [spf:guess,iffy] Re: [spf:guess,iffy] [PATCH] git-svn: teach git-svn to populate svn:mergeinfo

From
Sam Vilain <sam@vilain.net>
Date
Sep 2, 2011, 19:01 UTC
Message-ID
<4E6127F5.5070009@vilain.net>
In-Reply-To
<20110902144922.383ed0f1@robyn.woti.com>
On 9/2/11 11:49 AM, Bryan Jacobs wrote:
Show 9 quoted lines
> I could do a pass through all the commits which are about to be sent
> out to SVN to check if this is going to happen, yes. But I think a
> better solution would be to change how the changes are replayed by
> git-svn dcommit: right now, all changes are applied to the WC, then it
> sequentially does an add+dcommit for each patch? Right? I think it might
> be better to reset --hard to the parent, then pick each change into the
> WC+index before committing. That way if you abort early, cleaning up
> just consists of rebasing the stack onto the last change you sent
> upstream.

That's one way to do it; in fact, if the trees match you don't need to do anything complicated like cherry-pick.

ie, say you're committing
    r1---A---B---C---D
and it blows up at
    r1--r2--r3--C---D

So long as the tree from the fetched r3 == the tree from B, then you can just go ahead and write out new commits for C and D without doing any merging (ie cherry-pick or rebase). You could also put merge commits back the way they were, too.

If they don't match, then something went wrong with the push really, or there is something weird going on. I'd try to avoid using cherry pick automatically in situations like this. There are too many error modes, and if it only happens when you don't know what's going on, it's not a good idea to try to fix that. If it /is/ a sufficiently unlikely error (ie, the trees not matching as above), then it would be better to simply bomb out and provide two commands:

* a 'git reset' command to restore to previous state (ie, before the 
dcommit)
* a 'git rebase' command to attempt to put the new history on top of the 
new upstream.  Rebase doesn't work with merges of course but it still 
should help the user figure out what to do.

Another benefit of this approach is that you don't need to muck with the WC + index at all, no matter what happens.

Sam
Previous: Bryan JacobsNext: Bryan Jacobs
Message 4 of 11 in “git-svn: teach git-svn to populate svn:mergeinfo”
  1. git-svn: teach git-svn to populate svn:mergeinfoBryan Jacobs, Sep 2, 2011
  2. Sam VilainSep 2, 2011
  3. Bryan JacobsSep 2, 2011
  4. Sam VilainSep 2, 2011
  5. Bryan JacobsSep 2, 2011
  6. Sam VilainSep 2, 2011
  7. Eric WongSep 3, 2011
  8. Bryan JacobsSep 6, 2011
  9. Eric WongSep 6, 2011
  10. Eric WongSep 6, 2011
  11. Bryan JacobsSep 7, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.