Re: git-svn: handling merge-base failures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Myrick <amyrick@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]