[MERGE] Exception when pulling from a location

John Arbash Meinel john at arbash-meinel.com
Sat Feb 7 17:34:50 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aaron Bentley wrote:
> John Arbash Meinel wrote:
>> We have a small bug in how 'bzr pull XXX' works. Basically, the first
>> thing we do is check to see if it is a 'mergeable' (aka bundle)
> 
> nitpick: (aka bundle or merge directive)
> 
> And it's hardly ever a bundle these days.

True, though I almost always call merge directives bundles because MD is
very unwieldy to actually use in conversation.

> 
>> Ultimately, I think our logic is probably backwards. We should try to do
>> "Branch.open()" first, and then try "read_mergeable_from_url"
>> afterwards.
> 
> If you do Branch.open, followed by read_mergeable_from_url, the result
> should be the same as if you do read_mergeable_from_url, then Branch.open.
> 
> Why is one backwards and the other not?
> 

Because the former will try to read from a directory, and is the
uncommon case. It also causes problems with HTTP servers that don't
support index listings, or cause redirections (like trying to GET
http://bazaar.launchpad.net/~foo/bar/baz/ will try to redirect you to
.../~foo/bar/baz/changes because that is what a web-browser should see.)

>> I think the reason we did it this way was because of
>> "Branch.open_containing()". If you supplied the path to a bundle, we
>> wouldn't want to open the containing branch.
> 
> That's right, and it's more acute for the merge command, because you can
> specify a file to merge, so Branch.open_containing must be used.
> 
> In the case where the specified file is versioned, and is a merge
> directive, should merge treat it as a versioned file, or as a merge
> directive?
> 
> Aaron

Versioning your merge directives is certainly an edge case that we could
support either way, or allow an explicit flag for what we want to do
with them.

I think doing a partial merge of a versioned merge directive is an even
further edge case, so I would officially say it should act as though the
MD wasn't versioned at all. In fact, the case I would originally try to
handle is:

  bzr send -o foo.patch
  cd ../other
  bzr merge ../orig/foo.patch

In this case "foo.patch" isn't versioned, but happens to be inside a
versioned directory.

Still, for 'bzr pull' I think it makes the most sense to try as a
Branch.open() first, because it is unambiguous. I can respect that we
have a harder time with "bzr merge", though it would be nice to not get
redirect errors.

Perhaps we could change the "read_mergeable_from_url" code to never
follow redirects? Or is that something people are going to want? (IMO
merge-directives are meant to be ephemeral, and not something that you
are going to go through the effort of setting up a redirect for.)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmNxjoACgkQJdeBCYSNAAOCEgCgjUJbsX2VTXeQjgjTgKLa5niU
LQ8An2vGu+lxJSkWqE1V7XGglwss9+dK
=Dbcu
-----END PGP SIGNATURE-----



More information about the bazaar mailing list