git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH/RFC 01/10] Teach rebase interactive the mark command
@ 2008-04-13 20:51 Paul Fredrickson
  2008-04-14  9:27 ` Jörg Sommer
  2008-04-14 14:10 ` Johannes Schindelin
  0 siblings, 2 replies; 14+ messages in thread
From: Paul Fredrickson @ 2008-04-13 20:51 UTC (permalink / raw)
  To: git; +Cc: joerg, junio, Johannes.Schindelin

> Jrg Sommer <joerg@alea.gnuu.de> wrote:
> > > Wouldn't
> > >
> > > pick 5cc8f37 (init: show "Reinit" message even in ...)
> > > mark 1
> > > pick 18d077c (quiltimport: fix misquoting of parse...)
> > > mark 2
> > > reset 1
> >
> > "reset 18d077c~2" or "reset some-tag" or "reset my-branch~12"
> >
> >         merge #2
> > >
> > > be easier for people?
> >
> > I don't know. Using the special sign everywhere a mark is used looks more
> > consistent to me. The only case where it might be omitted is the mark
> > command, because it only uses marks.
>
> Why not use the mark syntax that fast-import uses?  In fast-import
> we use ":n" anytime we need to refer to a mark, e.g. ":1" or ":5".
> Its the same idea.  We already have a language for it.  Heck, the
> commands above are bordering on a language not too far from the
> one that fast-import accepts.  :-)

I like the idea of adding marks to an interactive rebase in general, but instead
of adding a separate command, what if rebase *automatically* marked all the
commits in the session:

    1: pick 5cc8f37 (init: show "Reinit" message even in ...)
    2: pick 18d007c (quiltimport: fix misquoting of parse ...)
    reset 1
    merge 2

or "reset :1" and "merge :2".  Neither notation bothers me for marks.

--Paul

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] git-rebase -i: New option to support rebase with merges
@ 2008-03-24 18:35 Junio C Hamano
  2008-04-09 23:58 ` Teach rebase interactive more commands to do better preserve merges Jörg Sommer
  0 siblings, 1 reply; 14+ messages in thread
From: Junio C Hamano @ 2008-03-24 18:35 UTC (permalink / raw)
  To: Jörg Sommer; +Cc: Johannes Schindelin, git, B.Steinbrink

Jörg Sommer <joerg@alea.gnuu.de> writes:

> Me too, but I think it's not possible to do what I want with -p. -p
> misses a definition of the (new) parent of a commit. It tries to preserve
> all commits from all branches. But going through the _list_ of commands
> couldn't preserve this structure.
>
> o--A--B
>  \     \
>   C--D--M--E
>
> How should the graph look like after these commands:
>
> pick A
> pick C
> squash E
> # pick D
> pick B
> pick M

I am beginning to suspect that the root cause of this is that the todo
language is not expressive enough to reproduce a merge _and_ allow end
user editing.

Let's step back a bit.

If you have this history:

      o---o---o---o---o---Z
     /
    X---Y---A---B
         \       \
          C---D---M---E

and you want to transplant the history  between X..E on top of Z, from the
command line you would say:

	$ git rebase --interactive -p --onto Z X E

First let's think what you would do if you want to do this by hand.  The
sequence would be:

	$ git checkout Z^0 ;# detach at Z

        $ git cherry-pick Y
        $ git tag new-Y ;# remember it
        $ git cherry-pick A
        $ git cherry-pick B
        $ git tag new-B ;# remember it
        $ git checkout new-Y
        $ git cherry-pick C
        $ git cherry-pick D
        $ git merge new-B ;# this reproduces M
        $ git cherry-pick E

	$ git branch -f $the_branch && git checkout $the_branch


Now how does the todo file before you edit look like?

	pick Y
        pick A
        pick B
        pick C
        pick D
        pick M
        pick E

The todo file expects the initial detaching and the final switching back
outside of its control, so it is Ok that the first "checkout Z^0" and the
last "branch && checkout" do not appear, but it should be able to express
the remainder and let you tweak.  Is it expressive enough to do so?  

Most of the "pick" from the above list literally translate to the
"cherry-pick", and if you change any of them to "edit", that is
"cherry-pick --no-edit" followed by a return of control to you with insn
to "rebase --continue" to resume.  There appears nothing magical.

Not really.  There already are two gotchas even without talking about
end-user editing.

First, "pick M" is not "cherry-pick M".  You do not want to end up with
merging an old parent before rewriting.  It has to be something like
"merge rewritten-Y".

Second, before you start picking C, if you want to preserve merges, you
have to switch to rewritten Y.  The original sequence left in todo does
not have that information to begin with.  We need, before the "pick C", to
say the equivalent of "git checkout new-Y" in the manual sequence
illustrated above.  The lack of "checkout new-Y" is perfectly fine if
rebase is meant to linearlize the history, but if you want to preserve the
shape of the history, you would need to give a clue that the sequence that
begins with the "pick C" starts from somewhere else.

You also need to make sure that "pick M" moved elsewhere still merges the
tips of two forked histories.  Moving "pick M" before "pick C" or "pick A"
would not make much sense.  So you would need some kind of "barrier" that
says "do not move this 'pick M' beyond this point".

Perhaps we can make it clearer by introducing a few more primitives to the
todo language: mark, reset and merge.  The above illustrated history would
then become:

	pick Y
        mark #0
	pick A
        pick B
        mark #1
        reset #0
        pick C
        pick D
	mark #2
        merge #1 #2
        pick E

You can change any of the "pick" to "edit, or drop it, and you can reorder
"pick" in a sequence of "pick", but you cannot change "mark", "reset",
"merge", or move "pick" across insn that was not originally "pick".

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-04-15  0:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-13 20:51 [PATCH/RFC 01/10] Teach rebase interactive the mark command Paul Fredrickson
2008-04-14  9:27 ` Jörg Sommer
2008-04-14 14:10 ` Johannes Schindelin
2008-04-15  0:11   ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2008-03-24 18:35 [PATCH 4/4] git-rebase -i: New option to support rebase with merges Junio C Hamano
2008-04-09 23:58 ` Teach rebase interactive more commands to do better preserve merges Jörg Sommer
2008-04-09 23:58   ` [PATCH/RFC 01/10] Teach rebase interactive the mark command Jörg Sommer
2008-04-10  9:33     ` Mike Ralphson
2008-04-12 10:17       ` Jörg Sommer
2008-04-11 23:48     ` Junio C Hamano
2008-04-12 10:11       ` Jörg Sommer
2008-04-13  3:56         ` Shawn O. Pearce
2008-04-13 16:50           ` Jörg Sommer
2008-04-14  6:24             ` Shawn O. Pearce
2008-04-14  6:54               ` Junio C Hamano
2008-04-14 10:06               ` Jörg Sommer

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).