vim-renamer icon indicating copy to clipboard operation
vim-renamer copied to clipboard

rename using subversion's 'svn mv'

Open mgr2000 opened this issue 8 years ago • 3 comments

I have the issue of having to rename a lot of files under subversion control. So the renaming has to be done with 'svn mv' instead of system's copy and rename. Could you add the option to rename this way or make the rename command configurable? Or even detect if a file is under subversion control and then use then 'svn mv' automatically?

mgr2000 avatar Oct 11 '16 06:10 mgr2000

Hi - apologies for not responding for... months - I certainly hope you've found a solution long ago! I guess your request is quite doable - with one caveat. Suppose you have two files, A and B, and you wish to swap their names - ie, A -> B, and B -> A. Given renames happen one at a time, we can't rename A to B without overwriting the original B, and we can't rename B to A without overwriting original A. To get around this issue, renamer works by renaming A to 1_GOING_TO_B, and B to 2_GOING_TO_A, before doing a final rename to B and A, respectively. This is always done, in case of temporary conflicts. But I'm guessing you don't really want those intermediate names in subversion - so would it therefore be necessary instead to analyse if there's any files swapping names, and use intermediate files for those renames, but to do all other renames directly? Right now, that feels like more work than I'm keen to invest.

Ha - the other question I should ask - my work uses subversion too - but I've been exceedingly happy using git-svn instead, and thus interacting using git procedures. In that case - git mv is identical to mv or rename I believe - so you could use renamer, and let git-svn convert the renames to svn mv's automatically - perhaps? Not so good for huge repositories though...

qpkorr avatar Mar 01 '17 13:03 qpkorr

Hi John, thanks for asking! Yes, I already solved the problem. I patched your code to test for subversion control of the directory before moving. If you like I'll try to create a pull request. Renaming to a temporary file and then to the real target file with svn mv seems not to be a problem, the final commit to subversion does only contain the "real" renaming without the temporary.

mgr2000 avatar Mar 02 '17 18:03 mgr2000

Hi - good job! Re a pull request - I figure it's entirely your call. I don't expect to need svn support any time soon, but others might well benefit from your work if you've got the time to share it. (Feel free to add an attribution in the docs/renamer.txt file too)

qpkorr avatar Mar 03 '17 06:03 qpkorr