This is an old revision of the document!


A way to rename files while keeping the history is essential to any decent VCS.

CVS, well, does not cope at all with renames. We implement a crude way to deal with these by using direct repository intervention through the CVSmeisters (with all the risks that approach entail). Renaming a file is done through a direct copy of the <file>,v files from one place to the other (note that because we may have tags and branch tags within the files, we do not use mv even though the file moves. We use cp instead then mark the file as deleted).

hg mv is the way to rename files while retaining the history. Soon there will be history-sensitive rename and merge in Hg, sponsored by Sun. It means that if file “A” from repository “R” is renamed as “B” but “R” was cloned into “S” before “A” is renamed, then modifications to “A” in “S”, the modifications will show up in file “B” in “R” when merging (XXX is that clear?).

The history-sensitive rename/merge has been written and is available starting at revision 8c36b33a27c7 in the current Hg repository.

Supported (also see [http://venge.net/monotone/wiki/FeatureRename monotone:FeatureRename])

The rename command (also aliased as mv) will allow files and directories to be renamed without breaking forwards or backwards history. These changes can be committed along with content changes as a single revision. Commands that use the history, including log and merge and annotate, will follow files through arbitrary renames. Two revisions that rename the same original file to different names, or that rename two different files to the same new name, will (correctly) cause a conflict will need to be resolved before they can be merged.

  • versioncontrol/renaming.1160727861.txt.gz
  • Last modified: 2006/10/13 08:24
  • by OllivierRobert