tags:

views:

77

answers:

2

Newbie alert!

OK, I have a working central Mercurial repository that I've been working with for several weeks.

Everything has been great until I hit a really bizarre problem: my central server doesn't seem to be synced to itself? I only have one file that seems to be out-of-sync right now, but I really need to know how this happened to prevent it from happening in the future.

Scenario:

1) created Mercurial repository on server using an existing project directory. The directory contained the file 'mypage.aspx'.

2) On my workstation, I cloned the central repository

3) I made an edit to mypage.aspx

4) hg commit, then hg push from my workstation to the central server

5) now if I look at mypage.aspx on the server's repository using TortoiseHg's repository explorer, I see the change history for mypage.aspx -- an initial check-in and one edit. However, when I select 'Diff to local', it shows the current version on the server's disk is the original version, not the edited version!

I have not experimented with branching at all yet, so I'm sure I'm not getting a branch problem.

'hg status' on the server or client returns no pending changes.

If I create a clone of the server's repository to a new location, I see the same change history as I would expect, but the file on disk doesn't contain my edit.

So, to recap:

Central repository = original file, but shows change in revision history (bad)

Local repository 'A' = updated file, shows change in revision history (good)

Local repository 'B' = original file, but shows change in revision history (bad)

Help please!

Thanks,

David

+2  A: 

This is normal, as the repository on the server has two components: the actual repository of changesets (in the .hg subdirectory), and a working copy. When you push changes from the local repository on your workstation to the server repository, it updates the repository files on the server (in the .hg subdir), but it does not change the working copy files (outside the .hg subdir): this would require an explicit update operation on the server to change the working copy.

If the server repository is only being used as a repository, and you do all your actual work in clones, then you're probably better off using a "bare repository" on the server (just delete the working copy files and just keep only .hg subdirectory itself).

Stephen C. Steel
or use `hg update null` to have a bare repo, you'll have less chances to delete the wrong thing :)
tonfa
Thank you for the clarification. I think I'm going to continue with a full repository on the central server so I can perform my backups from there.
David Montgomery
@David - If you don't use the working copy for working, just eliminate it (using tonfa's safer procedure). Your backups should capture the .hg subdirectory. This gives you the entire history, not just the current snapshot.
Stephen C. Steel
+4  A: 

Sounds like you're looking at the working copy on the central repo. Just like your local repo, there is a working copy. Running hg update (or "Update to branch tip" in TortoiseHg) should sync the central repo's working copy to the latest.

ataylor
hg summary will show you the revision of the working copy; hg tip will show you the revision of the tip.
Niall C.
Thanks for the tip. It makes sense now that the initial panic has worn off! I found an item in the Mercurial FAQ that shows how to have the central repository perform an automatic update after a push, which is exactly what I wanted.
David Montgomery