All of lore.kernel.org
 help / color / mirror / Atom feed
* git svn push, git dcommit leads to commit duplication?
@ 2011-07-19 19:55 rupert THURNER
  2011-07-21 10:25 ` Thomas Rast
  0 siblings, 1 reply; 2+ messages in thread
From: rupert THURNER @ 2011-07-19 19:55 UTC (permalink / raw)
  To: git

we keep a svn clone of
https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg on
https://github.com/opencsw/pkg-all . usually i synchronize it with
"git svn rebase" and "git push" from a local clone created with "git
svn clone https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg".

last time i changed something in this local clone and pushed it to
github, and commited it to sourceforge via git svn dcommit. now the
commits are there two times, different. my guess was that dcommit
would add the svn related stuff to the existing git commits. what is
the correct usage to keep svn and git in sync?

$ git log origin/master..master
...
commit 38ed3e4dec877b356fbf3799d1419a89ce6d107f
Author: rthurner <rthurner@d3b55034-1cff-0310-a425-aefe953e1e90>
Date:   Sun Jul 17 09:25:14 2011 +0000

    libserf, obsolete devel, and not working 0-0 package

    git-svn-id:
https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg@15081
d3b55034-1cff-0310-a425-aefe953e1e90

commit 22340c05f87b19bde70fd04016bee39e24bb6c8b
Author: rthurner <rthurner@d3b55034-1cff-0310-a425-aefe953e1e90>
Date:   Sun Jul 17 09:24:53 2011 +0000

    libserf, obsolete devel, and not working 0-0 package

    git-svn-id:
https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg@15080
d3b55034-1cff-0310-a425-aefe953e1e90


$ git log master..origin/master
commit 25bf83cd73ad5ffb17a5bfb668ecdbde1b8971bd
Author: THURNER rupert <rupert@opencsw.org>
Date:   Sun Jul 17 11:23:15 2011 +0200

    libserf, obsolete devel, and not working 0-0 package

commit cd516e0f4a319ba2554ca29a911130b43b96f6ec
Author: THURNER rupert <rupert@opencsw.org>
Date:   Sun Jul 17 11:21:36 2011 +0200

    libserf, obsolete devel, and not working 0-0 package

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

* Re: git svn push, git dcommit leads to commit duplication?
  2011-07-19 19:55 git svn push, git dcommit leads to commit duplication? rupert THURNER
@ 2011-07-21 10:25 ` Thomas Rast
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Rast @ 2011-07-21 10:25 UTC (permalink / raw)
  To: rupert THURNER; +Cc: git

rupert THURNER wrote:
> we keep a svn clone of
> https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg on
> https://github.com/opencsw/pkg-all . usually i synchronize it with
> "git svn rebase" and "git push" from a local clone created with "git
> svn clone https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg".
> 
> last time i changed something in this local clone and pushed it to
> github, and commited it to sourceforge via git svn dcommit. now the
> commits are there two times, different. my guess was that dcommit
> would add the svn related stuff to the existing git commits. what is
> the correct usage to keep svn and git in sync?

Your guess is mostly correct.  To best understand what is going on,
keep in mind that "you can never modify, you can only rewrite and
forget"[1].

Suppose you say 'git svn dcommit' on history that looks like

  1---2---3--(4)--(5)    SVN

  o---o---o    (svn/trunk)
           \
            a---b---c   (master)

where 4 and 5 are commits not yet fetched from SVN (if any).


1. git-svn will first fetch the new SVN history, let's call them N:

     1---2---3---4---5    SVN

     o---o---o---N---N    (svn/trunk)
              \
               a---b---c   (master)

2. Then it will rebase your own work on top of the new SVN stuff:

     1---2---3---4---5    SVN

     o---o---o---N---N    (svn/trunk)
              \
               a---b---c   (master)


3. Then it will rebase your own work on top of the new SVN stuff:

     1---2---3---4---5    SVN

     o---o---o---N---N    (svn/trunk)
                      \
                       a'--b'--c'   (master)

4. Then it will commit all of that to SVN:

     1---2---3---4---5---6---7---8    SVN

     o---o---o---N---N    (svn/trunk)
                      \
                       a'--b'--c'   (master)

5. Then it will annotate your commits o' with the info coming back
   from SVN (such as author, etc.) and "replace" your master with it:

     1---2---3---4---5---6---7---8    SVN

     o---o---o---N---N---A---B---C    (svn/trunk, master)

   From the point of view of 'master', this is also much like a
   rebase, except that authors and timestamps change too and (unless
   disabled) git-svn-id: lines appear in your commit messages.


Does that clarify what happens?

[For the sake of completeness, I should point out that this is a
simplification.  Steps 3--5 are actually all done in one go *per
commit*, and step 3 does not use 'git-rebase' but a variant on the
theme that preserves merges of side branches.]


As for

> what is the correct usage to keep svn and git in sync?

the only way I know of that avoids constantly rebasing branches is to
never push anything before it has been dcommitted.


[1] Quoting Tv; he said it much better than I can.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

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

end of thread, other threads:[~2011-07-21 10:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-19 19:55 git svn push, git dcommit leads to commit duplication? rupert THURNER
2011-07-21 10:25 ` Thomas Rast

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.