On 2007-09-14 15:47, Vladimir Marek <[EMAIL PROTECTED]> wrote:
> > In general, mercurial will require you to force a push that adds an
> > extra head to the parent.  I can't currently remember if this is the
> > case with formal branches too, or just extra heads (which are assumed
> > to be unmerged).
>
> I believe that push warns you only for unmerged heads.

It warns if a push creates more heads, i.e. if there were 2 heads
already in the push destination, and the push would spawn a third it
will warn.  If no new heads are created it doesn't.

        /tmp/hgtest -> hg init foo
        /tmp/hgtest -> cd foo
        /tmp/hgtest/foo -> echo a > a
        /tmp/hgtest/foo -> hg add
        adding a
        /tmp/hgtest/foo -> hg ci -m 'add "a"'
        /tmp/hgtest/foo -> cd ..
        /tmp/hgtest -> hg clone foo bar
        1 files updated, 0 files merged, 0 files removed, 0 files unresolved
        /tmp/hgtest -> cd foo
        /tmp/hgtest/foo -> echo alpha > a
        /tmp/hgtest/foo -> hg ci -m 'switch to "alpha"'
        /tmp/hgtest/foo -> cd ../bar
        /tmp/hgtest/bar -> echo new a > a
        /tmp/hgtest/bar -> hg ci -m 'new "a"'
        /tmp/hgtest/bar -> hg push
        pushing to /tmp/hgtest/foo
        searching for changes
        abort: push creates new remote branches!
        (did you forget to merge? use push -f to force)

Forcing the push works (no hooks installed in this demo workspace):

        /tmp/hgtest/bar -> hg push -f
        pushing to /tmp/hgtest/foo
        searching for changes
        adding changesets
        adding manifests
        adding file changes
        added 1 changesets with 1 changes to 1 files (+1 heads)

Now we make more changes in the local 'head' of the 'bar' repo:

        /tmp/hgtest/bar -> echo super new a > a
        /tmp/hgtest/bar -> hg ci -m 'super new "a"'

The next "push" does append a changeset to the history of an existing
head of the remote workspace, but it doesn't spawn an *extra* head, so
it doesn't warn at all:

        /tmp/hgtest/bar -> hg push
        pushing to /tmp/hgtest/foo
        searching for changes
        note: unsynced remote changes!
        adding changesets
        adding manifests
        adding file changes
        added 1 changesets with 1 changes to 1 files
        /tmp/hgtest/bar ->

_______________________________________________
tools-discuss mailing list
tools-discuss@opensolaris.org

Reply via email to