Any way to relate repos w/o cloning?

Ted Pavlic ted at tedpavlic.com
Thu Nov 13 10:55:00 CST 2008


Chris --

>     First: By itself, pulling doesn't change the working directory. That
>     is, you need to "hg update" after the pull in order to get the
>     working directory in sync with the new tip (note: an "hg merge"
>     might be required here; after the merge, you'll have to check in the
>     resulting working directory as a new changeset).
> 
>     Second: "hg status" detects whether the working directory has
>     changed with respect to the repo. Doing an "hg pull" followed by an
>     "hg update" will not cause "hg status" to report any change because
>     the working directory will be in sync with an existing changeset. 
> 
> Yes, but if I do the pull without doing an update, shouldn't hg st 
> report the updates that would occur in the working dir when I do an update?

	No. See "hg help status" -- "show changed files in the working directory".

	Also try "hg parent". You'll see that the working directory is a 
version of the changeset you had *before* the pull. Because the working 
directory matches that revision, "hg status" doesn't report anything.

	You can always do:

	hg diff -r tip

to diff the current revision (from "hg parent") with the tip (which 
should be the most recently added changeset from your hg pull). Sometimes:

	hg diff -r tip|diffstat

is nice.

> Does it have something to do with the multiple heads??  Here's the 
> output from hg heads:
> 
> changeset:   1:ec46614b071e
> tag:         tip
> parent:      -1:000000000000
> user:        cstromberger
> date:        Thu Nov 13 07:13:24 2008 -0800
> summary:     Initial import
> 
> changeset:   0:cc98724a0a7a
> user:        cstromberger
> date:        Thu Nov 13 08:11:06 2008 -0800
> summary:     Initial import

	If you do a:

	hg parent

I think you'll see that the working directory matches changeset 0. Try 
doing:

	hg diff -r tip

or

	hg diff -r 1

to see the difference between the working directory and the new changeset.

	Alternatively, you can try:

	hg merge

which will attempt to merge the heads at revisions 1 and 0. Then you can do:

	hg status

to see the damage to the new working directory. You can then commit that 
new working directory with...

	hg commit -m "Merge heads"

which creates a new changeset with the merged changes. Doing "hg heads" 
will show you only that new changeset.

	Does that make more sense?

	--Ted

-- 
Ted Pavlic <ted at tedpavlic.com>


More information about the Mercurial mailing list