Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adejones/98c8920f052ebbf40feac46bfbe9a524 to your computer and use it in GitHub Desktop.
Save adejones/98c8920f052ebbf40feac46bfbe9a524 to your computer and use it in GitHub Desktop.
rem cd to the full repo directory
cd path\to\full_repo
rem export tracked files in sub directory by creating a filemap using an intermediary temp file
set SUBDIR=name_of_subdir
hg locate -I "%SUBDIR%" > ..\filemap.tmp
for /f "tokens=*" %A in (..\filemap.tmp) do @echo include %A >> ..\filemap.txt
echo rename "%SUBDIR%" . >> ..\filemap.txt
del ..\filemap.tmp
rem create new repo using filemap
hg convert --filemap ..\filemap.txt . ..\new_repo_name
rem cd to new repo and update to latest head revision, the update is required if you want to see your files
cd ..\new_repo_name
hg update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment