Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does hg pull only operate on the current working directory?

I have multiple mercurial repositories and used hg clone to create backups of them on our file server. Now I want to write a batch file that updates them once a day by running hg pull -u on each subdirectory.

I want to keep this backup script as generic as possible, so it should update all backup repositories stored in my H:\BACKUPS\REPOS folder. This is my hgbackup.bat that is stored in the same folder:

for /f "delims=" %%i in ('dir /ad/b') do hg pull -u

The problem: hg pull only seems to operate on the current working directory, there seems to be no switch to specify the target repository for the pull. As I hate Windows Batch Scripting, I want to keep my .bat as simple as possible and avoid cd'ing to the different directories.

Any ideas how I can run hg pull -u on a different directory?

like image 201
fbuchinger Avatar asked Nov 23 '09 09:11

fbuchinger


People also ask

What does hg pull do?

Description. Pull changes from a remote repository to a local one. This finds all changes from the repository at the specified path or URL and adds them to a local repository (the current one unless -R is specified).

What does hg update do?

Update sets the working directory's parent revision to the specified changeset (see hg help parents). If the changeset is not a descendant or ancestor of the working directory's parent and there are uncommitted changes, the update is aborted.

What is hg status?

hg status shows the status of a repository. Files are stored in a project's working directory (which users see), and the local repository (where committed snapshots are permanently recorded). hg add tells Mercurial to track files. hg commit creates a snapshot of the changes to 1 or more files in the local repository.


1 Answers

Use the -R-switch:

hg pull -u -R /path/to/repository

See hg -v help pull for all command line options of hg pull (the -v switch tells help to include global options).

like image 75
Benjamin Wohlwend Avatar answered Oct 05 '22 06:10

Benjamin Wohlwend