Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use hg to synchronize my project between my two computer

Tags:

mercurial

I have two computer : the desktop in my company and the portable computer in my home.

Now I want to use the hg to synchronize the project between them using a "USB removable disk".

So I wonder how to implement it?

THe pro in my desktop is : D:\work\mypro.

I use the following command to init it:

hg init

Then I connect to the USB disk whose volume label is "H",and get a clone using:

cd H:
hg init
hg clone D:\work\mypro mypro-usb

ANd in my portable computer I use:

cd D:
hg clone H:\mypro-usb mypro-home

However I do not know how to do if I modify some files(remove or add and modify) in the mypro-home,how to make the mypro-usb changed synchronizely,also I want the mypro in my desktop synchronizely.

How to do it?

---------------The following is added after I get an answer from richj----------------

to richj:

Thanks for your reply.

The following is my practice: Pro-Com is the project(initialized as a repository) in my desktop, Pro-USB is the repository in my USB, the Pro-Home is the repository in my home computer.

When I make some change in the Pro-Com, I use the following command:

hg add
hg push Pro-USB

Then I change the directory to Pro-USB,using:

hg update
hg push Pro-Home

In my home computer I run:

hg update
(make some edition)
hg commit
hg push Pro-USB

Then the repository in the USB is the same as that of my home computer,I can push it to my desktop.

In my opinion,operation between repository can be done just by "hg push" and "hg pull",the other commands like "hg update" "hg import" just work between a working-copy and its repository.

Is my understanding right?

like image 466
hguser Avatar asked Apr 01 '10 09:04

hguser


1 Answers

To push changes from your working repositories back to your USB drive:

hg push

To get the latest changes from your USB drive:

hg pull
hg update

These two commands can be combined together like this:

hg pull -u

If you want to see which change sets are available to be pushed or pulled use:

hg outgoing
hg incoming

respectively. Any changes that you make to your local file system must be committed to the repository using:

hg commit

before they can be pushed or pulled.

like image 124
richj Avatar answered Sep 28 '22 00:09

richj