Wednesday, September 15, 2010

Moving files

Moving files is an operation many programmers hesitate to do. It complicates matters when integrating code branches, often the source control program either doesn't handle renaming / moving very well, and even though it's not very "difficult", it is often more trouble than it's worth. In fact the process of moving / renaming files is very mechanical and boring, and the one thing that would help matters is a clear check list of what not to forget. So here's one I made.
  1. Copy files from source to destination on disk
  2. Add new files to the solution / project
  3. Delete old files from the solution / project
  4. Remove old files from source control
  5. Add new files to source control
  6. Replace existing references - files that weren't moved should refer to the right path on disk / in the solution
  7. Delete old files from disk (if the source control doesn't already do that for you)
  8. Submit to source control
  9. Make sure you didn't break the build
  10. Sleep with a clean conscience the next night
    It may be that your source control software is smart enough that you can skip some of these steps, but overall this is what I have to do with Perforce and Visual Studio.

    2 comments:

    1. indeed - when using git i don't have to care at all. it also handles merging branches well even with renamed files.

      so my steps are:
      1. git mv old_name new_name
      2. edit makefile
      3. ???
      4. PROFIT

      ReplyDelete
    2. Unfortunately I use Perforce, and the Visual Studio / Perforce integration is pretty poor, when it comes to handling newly added files, deleted files, or moved files - even when you use NiftyPerforce. I realize that the right tools are a big factor here, and a lot of this stuff wouldn't be necessary if the tools were right. For example, previously, renaming classes and references used to be a hassle, but now with VisualAssist + NiftyPerforce that's done seamlessly with one click.

      ReplyDelete