Skip to content

Instantly share code, notes, and snippets.

@tathamoddie
Created August 5, 2010 00:10
Show Gist options
  • Save tathamoddie/509007 to your computer and use it in GitHub Desktop.
Save tathamoddie/509007 to your computer and use it in GitHub Desktop.
### TFS 2008 can't copy a file without breaking the history, which just baffles me ###
### This is how Hg does it: ####
D:\temp>mkdir HgCopyTest
D:\temp>cd HgCopyTest
D:\temp\HgCopyTest>hg init
D:\temp\HgCopyTest>echo Hello there > A.txt
D:\temp\HgCopyTest>hg add A.txt
D:\temp\HgCopyTest>hg com A.txt -m "Added A.txt"
D:\temp\HgCopyTest>hg annotate A.txt
0: Hello there
D:\temp\HgCopyTest>hg copy A.txt B.txt
D:\temp\HgCopyTest>hg com -m "Copied A.txt to B.txt"
D:\temp\HgCopyTest>hg annotate B.txt
0: Hello there
D:\temp\HgCopyTest>echo Some new line >> B.txt
D:\temp\HgCopyTest>hg com -m "Added new content to B.txt"
D:\temp\HgCopyTest>hg annotate B.txt
0: Hello there
2: Some new line
### Note that the first line of text is correctly annotated against changeset 0 when it was written, not changeset 1 when the file was copied ###
D:\temp\HgCopyTest>hg log -l 5
changeset: 2:90cc3db52177
tag: tip
user: Tatham Oddie <[email protected]>
date: Thu Aug 05 10:09:47 2010 +1000
summary: Added new content to B.txt
changeset: 1:e97284c83e28
user: Tatham Oddie <[email protected]>
date: Thu Aug 05 10:08:40 2010 +1000
summary: Copied A.txt to B.txt
changeset: 0:51a925a74a0f
user: Tatham Oddie <[email protected]>
date: Thu Aug 05 10:08:09 2010 +1000
summary: Added A.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment