Search Unity

moving or deleting files with SVN

Discussion in 'Editor & General Support' started by Sortasoft, Apr 15, 2010.

  1. Sortasoft

    Sortasoft

    Joined:
    Feb 24, 2009
    Posts:
    61
    Is there some trick to reliably move or delete a file/folder in your project when using SVN? This is especially difficult if you want to rename a folder.

    If I do the initial rename with SVN, then I lose references in the Unity project.

    If I do the initial rename in Unity, then SVN gets confused.

    The best solution I have come up with, is to rename in Unity (this changes reference). Then quit Unity and rename in the file system to the original name. Then finally do the SVN rename. This is such a hack, please tell me there's a better way!
     
  2. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    I haven't noticed any problems renaming in Unity assets and then committing changes.

    All that happens for me is that the old assets are shown as missing in the pre commit dialog of tortoise SVN. When I commit, those missing files are shown to have been deleted, the new files committed and everything runs normally.

    Are you using pro with VCE enabled in editor settings? Only other thing we did was disable libraries/cache and libraries/metadata

    Perhaps your still committing those and the old metadata is confusing things? With VCS enabled the correct metadata is stored alongside your assets. So long as you edit your folders, move, delete and rename files from within Unity not explorer it should all work fine.
     
  3. Sortasoft

    Sortasoft

    Joined:
    Feb 24, 2009
    Posts:
    61
    Thanks for the advice. Yup I have VCE enabled. I tried and you're correct about individual files. However, the issue remains when renaming a folder. The old .svn folder inside of it still thinks it is the original folder name.
     
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    You need to do the rename in unity, after that, go to the renamed folder, delete the .svn folder in there and normally add this new folder to svn. Then go back to the original place, make a revert there for the folder so it reappaers then svn delete it.
     
  5. dmitryb

    dmitryb

    Joined:
    Oct 21, 2009
    Posts:
    15
    second this.

    Is there a way to write a script that will be executed on drag file/folder commands?
     
  6. brad_ict

    brad_ict

    Joined:
    Sep 14, 2010
    Posts:
    69
    bump!

    So, the Unity docs say:
    I understand that ultimately moving and renaming has to be done with SVN, but this thread indicates that doing so FIRST would break connections with objects <-> scripts. Anyone from Unity that can chime in and advise on the best practice for this? If dreamora and Tysoe are correct, it seems Unity should really add these points to the documentation..it's certainly not a straightforward workflow most users will just figure out..
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    My recommended workflow with SVN / GIT is:

    do yourself the favor, buy smartSVN / smartGIT (own both and couldn't be any happier and that as a multiyear user of tortoise) and then just move the file in unity.

    now switch to smartSVN into your project in there and start the "detect move" functionality or just do a commit in which case it does it too. in 90%++ of the cases it will automatically detect moves.

    also it detects added and removed files which all in all makes svn a 10 times more pleasant experience especially when used as VCS in unity :)
     
    drewvancamp likes this.
  8. brad_ict

    brad_ict

    Joined:
    Sep 14, 2010
    Posts:
    69
    Thanks very much for the advice! Wondering if you can clarify or reword what you're talking about here:

    What about the .meta files? Did you configure smartSVN to handle these?
     
  9. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    it will handle them too once added to the svn repository which it will do on the first commit unless you tell it to not add them (it by default adds all files, shows that very well done and with meaningfull coloring in the commit dialog)

    they have a trial license so you can give it a go before deciding to invest
    another factor for me was that it is cross platform so I can use it on my windows as well as my osx box, not keeping 2 tools in mind etc
     
  10. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    Uh, you guys do realize that if you delete/add in subversion, you lose all history, yes?

    Using something like smartSVN to actually detect the move and let subversion realize it is a move and not a new file is definitely what you want to do.
     
    drewvancamp likes this.
  11. brad_ict

    brad_ict

    Joined:
    Sep 14, 2010
    Posts:
    69
    Great point Tom, I was gonna raise that issue. Our team is going to look at SmartSVN, I'll post lessons learned and workflow specifics for the community.
     
  12. EJSainz

    EJSainz

    Joined:
    Mar 24, 2015
    Posts:
    30
    I know this is a very old thread, but it would be great if @brad_ict could share your team experience with SmartSVN.

    In our case it's about not losing history, but also about not having to commit a heavy load of data: in order to keep the project organized we move a lot of data, and having to commit it to a slow-but-cheap SVN repo takes a lot of time.

    Thanks in advance for your insight!