On 2007-09-14 19:05, Vladimir Marek <[EMAIL PROTECTED]> wrote: > > > 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. > > Ah I see. Yes I tried this > > # Create main repo > rm -rf main local_a local_b > hg init main > cd main > echo file > file > hg ci --addremove -m file > cd .. > > # now there are two clones > hg clone main local_a > hg clone main local_b > > # clone a creates branch (no new head created, so no warning) > cd local_a > hg branch my_branch > hg ci -m my-branch > hg push
Hmmm, I see what you mean now. It's very odd that Hg allows you to commit and create a new changeset without actually modifying _any_ files after "hg branch foo"! > # clone b just tries to push to default branch (he does not know that > # clone b created his own branch). Now he is yelled at that he's trying > # to create new head > cd ../local_b > echo a > a > hg ci --addremove -m a > hg push > > pushing to /store/rcs/test/main > searching for changes > abort: push creates new remote branches! > (did you forget to merge? use push -f to force) > > I agree that this is a bit constructed example. It will boil down to the > fact that you have to trust your commiters to some degree. The local_b > should then pull, update, merge (in the correct direction) and push. > This would inactivate the branch created by local_a. > > My original question was if it would be possible to stop local_b from > creating new branch. If I would in a hook test output of 'hg branches' > and rollback if there is something new, it should work. I'm not 100% sure about this. We should probably ask the Mercurial Crew team -- i.e. by a post at <[EMAIL PROTECTED]>. Without actually committing a 'null changeset' after "hg branch my_branch" it seems that Hg can easily get confused: % kobe:/tmp/hgtest$ rm -fr local_a % kobe:/tmp/hgtest$ hg clone main local_a % cd local1 files updated, 0 files merged, 0 files removed, 0 files unresolved % kobe:/tmp/hgtest$ cd local_a % kobe:/tmp/hgtest/local_a$ ls -la % total 8 % drwxrwxr-x 3 keramida wheel - 512 Sep 15 03:32 . % drwxrwxr-x 5 keramida wheel - 512 Sep 15 03:32 .. % drwxrwxr-x 3 keramida wheel - 512 Sep 15 03:32 .hg % -rw-rw-r-- 1 keramida wheel - 5 Sep 15 03:32 file % kobe:/tmp/hgtest/local_a$ hg branch my_branch % marked working directory as branch my_branch % kobe:/tmp/hgtest/local_a$ hg branches % default 0:817d03aa7709 % kobe:/tmp/hgtest/local_a$ hg id % 817d03aa7709 (my_branch) tip % kobe:/tmp/hgtest/local_a$ hg diff --git -r tip % kobe:/tmp/hgtest/local_a$ hg --debug diff --git -r tip % kobe:/tmp/hgtest/local_a$ hg up -C my_branch % abort: unknown revision 'my_branch'! % kobe:/tmp/hgtest/local_a$ hg ci -m 'create a new my_branch head' % kobe:/tmp/hgtest/local_a$ hg log % changeset: 1:e45720581ee5 % branch: my_branch % tag: tip % user: Giorgos Keramidas <[EMAIL PROTECTED]> % date: Sat Sep 15 03:33:54 2007 +0300 % summary: create a new my_branch head % % changeset: 0:817d03aa7709 % user: Giorgos Keramidas <[EMAIL PROTECTED]> % date: Sat Sep 15 03:29:11 2007 +0300 % summary: file % % kobe:/tmp/hgtest/local_a$ hg export --git tip % # HG changeset patch % # User Giorgos Keramidas <[EMAIL PROTECTED]> % # Date 1189816434 -10800 % # Branch my_branch % # Node ID e45720581ee543f5654ceb138d575214ff729423 % # Parent 817d03aa7709cf83a26eff1e43884cfe2a8bb3e8 % create a new my_branch head % % kobe:/tmp/hgtest/local_a$ It seems quite unintuitive that a changeset _can_ be committed on a branch-point without _any_ actual file content change or a 'merge changeset' of two parents. - Giorgos _______________________________________________ tools-discuss mailing list tools-discuss@opensolaris.org