* git-svn: handling merge-base failures @ 2009-12-23 19:54 Andrew Myrick 2009-12-23 20:09 ` Eric Wong 2010-01-04 1:37 ` Andrew Myrick 0 siblings, 2 replies; 7+ messages in thread From: Andrew Myrick @ 2009-12-23 19:54 UTC (permalink / raw) To: git; +Cc: Eric Wong, Sam Vilain One of my projects is failing to clone because merge-base is failing on one of the revisions; the branch is a partial branch, so merge-base can't find a common ancestor with trunk. I'd like to catch the exception that command_oneline should throw when merge-base fails, but my perl is very rusty and I'm struggling to get git-svn.perl to grok the Git::Error::Command class. What is the appropriate way to import that class? Or more generally, is there a better solution to handling this error case? -Andrew ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-svn: handling merge-base failures 2009-12-23 19:54 git-svn: handling merge-base failures Andrew Myrick @ 2009-12-23 20:09 ` Eric Wong 2009-12-23 20:18 ` Andrew Myrick 2010-01-04 1:37 ` Andrew Myrick 1 sibling, 1 reply; 7+ messages in thread From: Eric Wong @ 2009-12-23 20:09 UTC (permalink / raw) To: Andrew Myrick; +Cc: git, Sam Vilain Andrew Myrick <amyrick@apple.com> wrote: > One of my projects is failing to clone because merge-base is failing > on one of the revisions; the branch is a partial branch, so merge-base > can't find a common ancestor with trunk. I'd like to catch the > exception that command_oneline should throw when merge-base fails, but > my perl is very rusty and I'm struggling to get git-svn.perl to grok > the Git::Error::Command class. What is the appropriate way to import > that class? Or more generally, is there a better solution to handling > this error case? Hi Andrew, Git::Error::Command should be imported with the rest of Git.pm It's a special way of doing exceptions in Perl which I don't see much point of... Looking at git-send-email as an example, it does this: use Error qw(:try); use Git; try { # something that will throw } catch Git::Error::Command with { # error handling } A more standard approach in Perl is just: eval { # something that will die }; if ($@) { # error handling } But yes, it is Perl after all and TMTOWTDI :) -- Eric Wong ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-svn: handling merge-base failures 2009-12-23 20:09 ` Eric Wong @ 2009-12-23 20:18 ` Andrew Myrick 2009-12-23 20:57 ` Eric Wong 0 siblings, 1 reply; 7+ messages in thread From: Andrew Myrick @ 2009-12-23 20:18 UTC (permalink / raw) To: Eric Wong; +Cc: git, Sam Vilain On Dec 23, 2009, at 12:09 PM, Eric Wong wrote: > Andrew Myrick <amyrick@apple.com> wrote: >> One of my projects is failing to clone because merge-base is failing >> on one of the revisions; the branch is a partial branch, so merge-base >> can't find a common ancestor with trunk. I'd like to catch the >> exception that command_oneline should throw when merge-base fails, but >> my perl is very rusty and I'm struggling to get git-svn.perl to grok >> the Git::Error::Command class. What is the appropriate way to import >> that class? Or more generally, is there a better solution to handling >> this error case? > > Hi Andrew, > > Git::Error::Command should be imported with the rest of Git.pm > > It's a special way of doing exceptions in Perl which I don't see much > point of... Looking at git-send-email as an example, it does this: > > use Error qw(:try); > use Git; > > try { > # something that will throw > } catch Git::Error::Command with { > # error handling > } I looked at git-send-email's example, but I wanted to do a bit more: try { # command_oneline(...); } catch Git::Error::Command with { $E = shift; if ($E->value() == 1) { # do something } else { # do something else } } This is used in perl/Git.pm, but when I tried it in git-svn.perl, it fails with the error "Can't locate object method 'value' via package 'Git::SVN'". > > A more standard approach in Perl is just: > > eval { > # something that will die > }; > if ($@) { > # error handling > } > Presumably $@ contains the Git::Error::Command object, which leaves me in the same spot, unfortunately. > But yes, it is Perl after all and TMTOWTDI :) Is there ever :) -Andrew ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-svn: handling merge-base failures 2009-12-23 20:18 ` Andrew Myrick @ 2009-12-23 20:57 ` Eric Wong 0 siblings, 0 replies; 7+ messages in thread From: Eric Wong @ 2009-12-23 20:57 UTC (permalink / raw) To: Andrew Myrick; +Cc: git, Sam Vilain Andrew Myrick <amyrick@apple.com> wrote: > On Dec 23, 2009, at 12:09 PM, Eric Wong wrote: > > Andrew Myrick <amyrick@apple.com> wrote: > >> One of my projects is failing to clone because merge-base is failing > >> on one of the revisions; the branch is a partial branch, so merge-base > >> can't find a common ancestor with trunk. I'd like to catch the > >> exception that command_oneline should throw when merge-base fails, but > >> my perl is very rusty and I'm struggling to get git-svn.perl to grok > >> the Git::Error::Command class. What is the appropriate way to import > >> that class? Or more generally, is there a better solution to handling > >> this error case? > > > > Hi Andrew, > > > > Git::Error::Command should be imported with the rest of Git.pm > > > > It's a special way of doing exceptions in Perl which I don't see much > > point of... Looking at git-send-email as an example, it does this: > > > > use Error qw(:try); > > use Git; > > > > try { > > # something that will throw > > } catch Git::Error::Command with { > > # error handling > > } > > I looked at git-send-email's example, but I wanted to do a bit more: > > try { > # command_oneline(...); > } catch Git::Error::Command with { > $E = shift; > if ($E->value() == 1) { > # do something > } else { > # do something else > } > } > > This is used in perl/Git.pm, but when I tried it in git-svn.perl, it > fails with the error "Can't locate object method 'value' via package > 'Git::SVN'". That's strange. I'm at a bit of a loss here so I'll wait for somebody with more Perl knowledge than myself. What happens when you dump @_ in your catch block? use Data::Dumper; try { } catch Git::Error::Command with { print STDERR Dumper(\@_); } > Presumably $@ contains the Git::Error::Command object, which leaves me > in the same spot, unfortunately. > > > But yes, it is Perl after all and TMTOWTDI :) > > Is there ever :) Yes I'm lost here, too, so in these cases I default to putting print statements everywhere and Data::Dumper :) -- Eric Wong ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-svn: handling merge-base failures 2009-12-23 19:54 git-svn: handling merge-base failures Andrew Myrick 2009-12-23 20:09 ` Eric Wong @ 2010-01-04 1:37 ` Andrew Myrick 2010-01-04 3:45 ` Eric Wong 1 sibling, 1 reply; 7+ messages in thread From: Andrew Myrick @ 2010-01-04 1:37 UTC (permalink / raw) To: git; +Cc: Eric Wong, Sam Vilain [-- Attachment #1: Type: text/plain, Size: 1536 bytes --] On Dec 23, 2009, at 11:54 AM, Andrew Myrick wrote: > One of my projects is failing to clone because merge-base is failing on one of the revisions; the branch is a partial branch, so merge-base can't find a common ancestor with trunk. I'd like to catch the exception that command_oneline should throw when merge-base fails, Instead of using the Error.pm module, I was able to handle the exception with the more basic eval block. However, there are some details here I would like to discuss with the community. When git-svn fetches a partial branch, it appears to refetch all of the history of the subdirectory from which the branch was created. This creates new commits for the old revisions, and these new commits exist as a separate history for the partial branch. When git-svn fetches the revision at which this partial branch is merged back to trunk, git-svn attempts to run merge-base to find a common ancestor. However, because the partial branch has its own history, the merge-base fails, and git-svn dies. Naively handling the exception with an eval block and skipping the merge ticket works fine in that it brings us back to parity with git 1.6.5.7, but it means that the merge parent relationship between trunk and the partial branch is lost. Is there any way to preserve this information, or does the separate commit history of the partial branch make it fundamentally impossible? I've created a small svn repository that demonstrates this failure with git v1.6.6. Its dump is attached. -Andrew [-- Attachment #2: partial.dump --] [-- Type: application/octet-stream, Size: 4314 bytes --] SVN-fs-dump-format-version: 2 UUID: ef8533a7-8eba-4e00-b9e4-68f81a8a4a0e Revision-number: 0 Prop-content-length: 56 Content-length: 56 K 8 svn:date V 27 2010-01-04T00:41:48.890110Z PROPS-END Revision-number: 1 Prop-content-length: 119 Content-length: 119 K 7 svn:log V 17 Initial import K 10 svn:author V 7 amyrick K 8 svn:date V 27 2010-01-04T00:42:12.648154Z PROPS-END Node-path: branches Node-kind: dir Node-action: add Prop-content-length: 10 Content-length: 10 PROPS-END Node-path: tags Node-kind: dir Node-action: add Prop-content-length: 10 Content-length: 10 PROPS-END Node-path: trunk Node-kind: dir Node-action: add Prop-content-length: 10 Content-length: 10 PROPS-END Revision-number: 2 Prop-content-length: 113 Content-length: 113 K 7 svn:log V 11 New files K 10 svn:author V 7 amyrick K 8 svn:date V 27 2010-01-04T00:43:30.046704Z PROPS-END Node-path: trunk/a Node-kind: dir Node-action: add Prop-content-length: 10 Content-length: 10 PROPS-END Node-path: trunk/a/file Node-kind: file Node-action: add Prop-content-length: 10 Text-content-length: 0 Text-content-md5: d41d8cd98f00b204e9800998ecf8427e Text-content-sha1: da39a3ee5e6b4b0d3255bfef95601890afd80709 Content-length: 10 PROPS-END Node-path: trunk/b Node-kind: dir Node-action: add Prop-content-length: 10 Content-length: 10 PROPS-END Node-path: trunk/b/file Node-kind: file Node-action: add Prop-content-length: 10 Text-content-length: 0 Text-content-md5: d41d8cd98f00b204e9800998ecf8427e Text-content-sha1: da39a3ee5e6b4b0d3255bfef95601890afd80709 Content-length: 10 PROPS-END Revision-number: 3 Prop-content-length: 122 Content-length: 122 K 7 svn:log V 20 Create full branch K 10 svn:author V 7 amyrick K 8 svn:date V 27 2010-01-04T00:44:34.670334Z PROPS-END Node-path: branches/fullbranch Node-kind: dir Node-action: add Node-copyfrom-rev: 2 Node-copyfrom-path: trunk Revision-number: 4 Prop-content-length: 112 Content-length: 112 K 7 svn:log V 10 Add text K 10 svn:author V 7 amyrick K 8 svn:date V 27 2010-01-04T00:45:11.654184Z PROPS-END Node-path: branches/fullbranch/a/file Node-kind: file Node-action: change Text-content-length: 5 Text-content-md5: 6137cde4893c59f76f005a8123d8e8e6 Text-content-sha1: c5d84736ba451747dd5f0eb9d17e104f3697ef47 Content-length: 5 data Revision-number: 5 Prop-content-length: 129 Content-length: 129 K 7 svn:log V 27 Merge fullbranch to trunk K 10 svn:author V 7 amyrick K 8 svn:date V 27 2010-01-04T00:45:41.203114Z PROPS-END Node-path: trunk Node-kind: dir Node-action: change Prop-content-length: 59 Content-length: 59 K 13 svn:mergeinfo V 24 /branches/fullbranch:3-4 PROPS-END Node-path: trunk/a/file Node-kind: file Node-action: change Text-content-length: 5 Text-content-md5: 6137cde4893c59f76f005a8123d8e8e6 Text-content-sha1: c5d84736ba451747dd5f0eb9d17e104f3697ef47 Content-length: 5 data Revision-number: 6 Prop-content-length: 125 Content-length: 125 K 7 svn:log V 23 Create partial branch K 10 svn:author V 7 amyrick K 8 svn:date V 27 2010-01-04T00:47:34.954727Z PROPS-END Node-path: branches/partialbranch Node-kind: dir Node-action: add Node-copyfrom-rev: 5 Node-copyfrom-path: trunk/b Prop-content-length: 61 Content-length: 61 K 13 svn:mergeinfo V 26 /branches/fullbranch/b:3-4 PROPS-END Revision-number: 7 Prop-content-length: 110 Content-length: 110 K 7 svn:log V 9 Add data K 10 svn:author V 7 amyrick K 8 svn:date V 27 2010-01-04T00:48:22.334502Z PROPS-END Node-path: branches/partialbranch/file Node-kind: file Node-action: change Text-content-length: 10 Text-content-md5: 284b44f9273171eb622b27d9a4df5acd Text-content-sha1: 59cb3d79577306b6be81d41c273ea47cd47968e1 Content-length: 10 more data Revision-number: 8 Prop-content-length: 133 Content-length: 133 K 7 svn:log V 31 Merge partial branch to trunk K 10 svn:author V 7 amyrick K 8 svn:date V 27 2010-01-04T00:49:11.588697Z PROPS-END Node-path: trunk/b Node-kind: dir Node-action: change Prop-content-length: 89 Content-length: 89 K 13 svn:mergeinfo V 54 /branches/fullbranch/b:3-4 /branches/partialbranch:6-7 PROPS-END Node-path: trunk/b/file Node-kind: file Node-action: change Text-content-length: 10 Text-content-md5: 284b44f9273171eb622b27d9a4df5acd Text-content-sha1: 59cb3d79577306b6be81d41c273ea47cd47968e1 Content-length: 10 more data ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-svn: handling merge-base failures 2010-01-04 1:37 ` Andrew Myrick @ 2010-01-04 3:45 ` Eric Wong 2010-01-04 4:43 ` Andrew Myrick 0 siblings, 1 reply; 7+ messages in thread From: Eric Wong @ 2010-01-04 3:45 UTC (permalink / raw) To: Andrew Myrick; +Cc: git, Sam Vilain Andrew Myrick <amyrick@apple.com> wrote: > On Dec 23, 2009, at 11:54 AM, Andrew Myrick wrote: > > One of my projects is failing to clone because merge-base is failing > > on one of the revisions; the branch is a partial branch, so > > merge-base can't find a common ancestor with trunk. I'd like to > > catch the exception that command_oneline should throw when > > merge-base fails, > > Instead of using the Error.pm module, I was able to handle the > exception with the more basic eval block. However, there are some > details here I would like to discuss with the community. > > When git-svn fetches a partial branch, it appears to refetch all of > the history of the subdirectory from which the branch was created. > This creates new commits for the old revisions, and these new commits > exist as a separate history for the partial branch. When git-svn > fetches the revision at which this partial branch is merged back to > trunk, git-svn attempts to run merge-base to find a common ancestor. > However, because the partial branch has its own history, the > merge-base fails, and git-svn dies. > > Naively handling the exception with an eval block and skipping the > merge ticket works fine in that it brings us back to parity with git > 1.6.5.7, but it means that the merge parent relationship between trunk > and the partial branch is lost. Is there any way to preserve this > information, or does the separate commit history of the partial branch > make it fundamentally impossible? Hi Andrew, A method of preserving the $SVN_PATH <=> $PARENT@$REV mapping for reusing follow_parent-created branches is definitely desired. I've just been lacking time and motivation these days with other projects taking priority. Help (even if it's just to refactor/cleanup existing code) would definitely be appreciated here. > I've created a small svn repository that demonstrates this failure > with git v1.6.6. Its dump is attached. Thanks. This (and a similar dump a few weeks back) will definitely come in handy for writing test cases and fixing this long-standing issue. -- Eric Wong ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: git-svn: handling merge-base failures 2010-01-04 3:45 ` Eric Wong @ 2010-01-04 4:43 ` Andrew Myrick 0 siblings, 0 replies; 7+ messages in thread From: Andrew Myrick @ 2010-01-04 4:43 UTC (permalink / raw) To: Eric Wong; +Cc: git, Sam Vilain On Jan 3, 2010, at 7:45 PM, Eric Wong wrote: > Andrew Myrick <amyrick@apple.com> wrote: >> On Dec 23, 2009, at 11:54 AM, Andrew Myrick wrote: >>> One of my projects is failing to clone because merge-base is failing >>> on one of the revisions; the branch is a partial branch, so >>> merge-base can't find a common ancestor with trunk. I'd like to >>> catch the exception that command_oneline should throw when >>> merge-base fails, >> >> Instead of using the Error.pm module, I was able to handle the >> exception with the more basic eval block. However, there are some >> details here I would like to discuss with the community. >> >> When git-svn fetches a partial branch, it appears to refetch all of >> the history of the subdirectory from which the branch was created. >> This creates new commits for the old revisions, and these new commits >> exist as a separate history for the partial branch. When git-svn >> fetches the revision at which this partial branch is merged back to >> trunk, git-svn attempts to run merge-base to find a common ancestor. >> However, because the partial branch has its own history, the >> merge-base fails, and git-svn dies. >> >> Naively handling the exception with an eval block and skipping the >> merge ticket works fine in that it brings us back to parity with git >> 1.6.5.7, but it means that the merge parent relationship between trunk >> and the partial branch is lost. Is there any way to preserve this >> information, or does the separate commit history of the partial branch >> make it fundamentally impossible? > > Hi Andrew, > > A method of preserving the $SVN_PATH <=> $PARENT@$REV mapping for > reusing follow_parent-created branches is definitely desired. > > I've just been lacking time and motivation these days with other > projects taking priority. Help (even if it's just to refactor/cleanup > existing code) would definitely be appreciated here. Thanks for the explanation, Eric. Unfortunately, I also don't have the time to commit to taking this on for the foreseeable future. I'll try to get my existing patches out in the next couple of days that at least fix the regressions from 1.6.5.7. Regards, Andrew ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-01-04 4:44 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-12-23 19:54 git-svn: handling merge-base failures Andrew Myrick 2009-12-23 20:09 ` Eric Wong 2009-12-23 20:18 ` Andrew Myrick 2009-12-23 20:57 ` Eric Wong 2010-01-04 1:37 ` Andrew Myrick 2010-01-04 3:45 ` Eric Wong 2010-01-04 4:43 ` Andrew Myrick
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox