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

Re: git-svn and mergeinfo

From
BJBryan Jacobs <bjacobs@woti.com>
Date
Sep 1, 2011, 14:43 UTC
Message-ID
<20110901104327.14d4dba6@robyn.woti.com>
In-Reply-To
<4E5F4987.5040205@alum.mit.edu>

On Thu, 01 Sep 2011 10:59:51 +0200 Michael Haggerty <mhagger@alum.mit.edu> wrote:

Show 26 quoted lines
> On 08/29/2011 07:20 PM, Bryan Jacobs wrote:
> > I have been (ab)using git-svn for committing to a central SVN
> > repository while doing my work locally with git. To this end, I've
> > written a set of scripts and hooks which perform squash merges
> > locally and then dcommit them with proper svn:mergeinfo
> > annotations. The final result is the perfect appearance of having
> > done a native SVN merge in the central repository, while using only
> > local git commands and gaining the full benefit of git's conflict
> > resolution and developer convenience.
> > 
> > However, to make this work with git 1.7.6, I needed to make *one*
> > change to the git internals: --merge-info does not allow setting
> > mergeinfo for more than one branch. Because it's a complete
> > overwrite operation instead of an update, this is a serious issue
> > preventing its use for nontrivial branches.
> > 
> > Might I suggest adding a block like the following around line 552 of
> > git-svn?
> > 
> >     if (defined($_merge_info))
> >     {  
> >         $_merge_info =~ tr{ }{\n};
> >     }
> 
> Naive question: why can't you pass a newline (properly quoted, of
> course) directly within the string argument to the --mergeinfo option?

The only way I know of to do that in bash is to assign the newline-bearing string to a variable, and then use the variable in a command line option. Extremely awkward.

I think the long-term solution for this issue is probably to have git-svn populate the mergeinfo on its own, reducing the need for users manipulating the value directly. This could in theory be done for both cherry picks and merges, provided that the merge was --no-ff or bears a body (so there is a commit object to carry the property change) and both parents are tagged with SVN revs at the time the merge is dcommitted (or, correspondingly, that the cherry-pick source carries an SVN revision number). I will send patches for some to all of this shortly as I pull my bash scripts into git-svn.perl and clean up the code.

The cost of the automatic svn:mergeinfo pushing will be an SVN property retrieval before each dcommit operation. I plan to have this behavior disabled by default.

Bryan Jacobs
Previous: Michael HaggertyNext: Junio C Hamano
Message 10 of 14 in “git-svn and mergeinfo”
  1. Bryan JacobsAug 29, 2011
  2. git bug reportingJeff King, Aug 29, 2011
  3. Bryan JacobsAug 29, 2011
  4. Junio C HamanoAug 29, 2011
  5. Sverre RabbelierAug 31, 2011
  6. Sverre RabbelierAug 31, 2011
  7. Bryan JacobsAug 31, 2011
  8. Sverre RabbelierAug 31, 2011
  9. Michael HaggertySep 1, 2011
  10. Bryan JacobsSep 1, 2011
  11. Junio C HamanoSep 1, 2011
  12. Carlos Martín NietoSep 6, 2011
  13. Bryan JacobsSep 6, 2011
  14. Carlos Martín NietoSep 6, 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.