Script to archive and deploy to source control with Mercurial

Specify the location of the repository to be cloned using <REPOSITORY_PATH>.

rmdir /S /Q repo_name
hg clone -u tip "<REPOSITORY_PATH>" repo_name
del /Q "repo_name\${JobName}\${TargetName}.zip"
mkdir "repo_name\${JobName}
winrar a "repo_name\${JobName}\${TargetName}.zip" -ep1 -r "${DeployFolder}\*"
cd repo_name
hg addremove
hg commit -m "Scheduled update from job: '${JobName}', target: '${TargetName}'."
hg push

Script steps explained:

  1. Remove any previously existing subdirectory named "repo_name" in the folder of the current job.
  2. Mercurial makes a copy of the repository at the path given at <REPOSITORY_PATH>.

  3. Delete the .zip file at the given path, should it exist.
  4. Make a new directory to place the archived file in.
  5. Instruct an archiving tool to create an archived file inside the newly created folder.
  6. Step inside the "repo_name" folder.
  7. Changes are compared between the local repository and the online repository. New files are added to the commit and missing files are removed.
  8. A commit is made to the online repository and a message is written for the commit.
  9. The committed files are pushed to the online repository.

HelpCenter/Tips/VersionControl/AutoMapOutputCheckinScripts/Mercurial (last edited 2017-02-17 18:02:08 by AshtonFrench)