[MERGE] mv accepts paths containing symlinks #66964

Aaron Bentley aaron.bentley at utoronto.ca
Thu Oct 26 17:00:37 BST 2006


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

John Arbash Meinel wrote:
> Aaron Bentley wrote:

> I think you mean:
> 
> $ ln -s ../bzr.dev mylink
> $ bzr add
> $ bzr commit -m "commit" mylink

Yes.

> Yes it is ambiguous.

I think the correct resolution to this ambiguity is to use the symlink,
not its target, because otherwise, there is no way to commit 'mylink'
specifically.

I am not sure whether we can also accomodate 48444 with our current
commandline interface.

> I have actually been thinking about why we do or don't change things
> into absolute paths.
> 
> Meaning, why do we *have* to change everything into an absolute path,
> rather than working on relative paths.

We change things to the realpath so that relationships among paths are
clearer.  ../foo/bar and baz/../qux/../../../quxxx may both be in the
same working tree, but you'd never know it to look at them.

> Also, when someone types 'bzr branch foo bar' they get:
> bzr: ERROR: No such branch file:///home/user/current/other/foo
> 
> Even if they got
> bzr: ERROR: No such branch /home/user/current/other/foo
> 
> Is that better than:
> bzr: ERROR: No such branch foo

Yes, IMHO.  Because the cause of the error may be that the user doesn't
understand what 'foo' means to bzr.

> It may be that we just need to recognize the duality of some paths. And
> keep 2 strings for each path that we access. One which is the path as
> the user gave it to us, and the other is some sort of 'absolute' path.
> And I think we might just reach the conclusion that it isn't worth the
> effort.

I think it would make the code a lot harder to work with.

> So if a user says 'bzr mv link newlink', we access it by its path, and
> just rename the link. But if they say 'bzr mv link/foo link/bar', then
> internally we go to 'link' and see that it is of kind InventoryLink

We don't know that 'link' is versioned.

, and
> we are trying to dereference to a child

We don't know that its child is versioned.  (Think bzr add)

> What to do for 'bzr commit link'? Either commit the link, or the link
> *and* what it points to. 'bzr commit link/' should just commit the
> target, etc, etc.

I like the first option better.

> This may be a point that we want to stop for a bit, take a step back,
> and really look at how we want bzr to interact with symlinks, write up
> some use cases, and figure out how we can make it simple enough to do in
> the codebase.

Are you okay with merging my fix for #66964, with the function renamed
to 'dereference_path'?

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFFQNul0F+nu1YWqI0RAkGkAJ9dQ5GYd+PLjYwxgNZj427D720R5ACfb8lP
/fbcgJ3SRgr+os60m1wr7KY=
=D7Bt
-----END PGP SIGNATURE-----




More information about the bazaar mailing list