update symlinks when target is moved

Bug #559199 reported by Jelmer Vernooij
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Wishlist
Unassigned
Breezy
Triaged
Low
Unassigned

Bug Description

I understand bzr uses file-IDs to identify each file as an entity (just as I, and probably most people, think of it).

Then it could auto-update symlinks if their target is bzr mv'ed. This would be a killer feature, and distinguish bzr (eg git couldn't do it).

What I mean is:

$ bzr init .
$ echo "hello world" > textfile.txt
$ ln -s textfile.txt link2text
$ bzr add *
$ bzr ci -m "set up"
$ bzr mv textfile.txt text.txt
$ bzr ci -m "commit a mv of file which is linked to (within branch)."

NOW I'd love to see

$ cat link2text
hello world

with this implemented bazaar would be THE vcs for me (and probably many others)

PS: I'm not sure where/how to post this feature request, but I thought if I "ask a question" it might end up in the right place :)

Tags: symlink
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This is an interesting idea.

I'm wondering though what the performance consequences of this would be, as we'd have to scan the tree for any symlinks that point to a file when that file is renamed.

I also wonder if there are perhaps situations in which you don't want the symlink to be updated automatically. E.g. what happens if you replace a file with another:

$ echo foo > bar
$ bzr add bar
$ ln -s bar link
$ bzr add link
$ bzr ci

$ bzr mv bar bla
$ echo hi > bar
$ bzr add bar
$ bzr ci

You might just want to keep link pointing at bar in this case.

Changed in bzr:
status: New → Confirmed
importance: Undecided → Wishlist
status: Confirmed → New
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

(Changed back as I'm not necessarily sure this is a good idea)

Revision history for this message
symlinker (m8r-6435301) wrote :

I agree there may be instances where you want to link to a path, and whatever file is there at the moment.

Very often, though, you want to link to a file as an entity, and in cleaning up it later may end up, say, in a subdir of its former position.

I agree bzr shouldn't all of a sudden forcibly move all links around.

Still, it would be a great feature that many will find useful. Especially if you version more than just source code.

- I would not do the searching and bzr mv, but on bzr commit. You need to search the tree anyways then (I presume), and it is reasonable that the link stays broken until you ci. This way you could but a new file it its place before you ci, like in your use case above. In that case it might be a smart assumption the link should not be changed.

- Probably we would need a switch after all: bzr mv --preserve-symlinks

- Coming from svn, I would simply define a property svn:sticky-symlink on the link itself: this would obviate the above switch, keep everything clean and simple and still provide the feature. I have no ideas about properties in bzr yet, though. Is there anything of the sort of the svn-book to cure my ignorance? lp:bzr-book seems to be stuck in rev 1, and the complete user reference is not quite a linear read...

Give it a consideration ;)

Martin Pool (mbp)
Changed in bzr:
status: New → Confirmed
Parth Malwankar (parthm)
tags: added: symlink
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.