[Bug 4025] New: hg doesn't warn user when pushing branch whose name is already taken on remote.
mercurial-bugs at selenic.com
mercurial-bugs at selenic.com
Wed Aug 21 08:06:58 UTC 2013
http://bz.selenic.com/show_bug.cgi?id=4025
Priority: normal
Bug ID: 4025
CC: mercurial-devel at selenic.com
Assignee: bugzilla at selenic.com
Summary: hg doesn't warn user when pushing branch whose name is
already taken on remote.
Severity: bug
Classification: Unclassified
OS: Linux
Reporter: g.gherdovich at gmail.com
Hardware: PC
Status: UNCONFIRMED
Version: 2.6.1
Component: mq
Product: Mercurial
hg doesn't allow you to give the same name to two different branches:
-----------------------------------------------------------------
$ hg init
$ touch foo ; hg add foo ; hg commit -m foo
$ touch bar ; hg add bar ; hg commit -m bar
$ hg branch baloo
marked working directory as branch baloo
(branches are permanent and global, did you want a bookmark?)
$ hg commit -m "named branch"
$ hg up 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ touch baz ; hg add baz ; hg commit -m baz
created new head
$ hg branch baloo
abort: a branch of the same name already exists
(use 'hg update' to switch to it)
-----------------------------------------------------------------
but what if you name a branch locally and the push to a remote where the name
is already taken?? No warning.
#--------------------
# A repo
#--------------------
$ mkdir a
$ cd a/
/a$ hg init
/a$ touch foo ; hg add foo ; hg commit -m foo
/a$ cd ..
#--------------------
# A clone
#--------------------
$ hg clone a b
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd b/
/b$ touch bar ; hg add bar ; hg commit -m bar
#--------------------
# Named branch on the clone
#--------------------
/b$ hg branch baloo
marked working directory as branch baloo
(branches are permanent and global, did you want a bookmark?)
/b$ hg commit -m "named branch"
#--------------------
# Named branch on the original repo
#--------------------
/b$ cd ../a/
/a$ touch baz ; hg add baz ; hg commit -m baz
/a$ hg branch baloo
marked working directory as branch baloo
(branches are permanent and global, did you want a bookmark?)
/a$ hg commit -m "named branch"
#--------------------
# pushing from the clone to the original
#--------------------
/a$ cd ../b/
/b$ hg push -f ../a
pushing to ../a
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 1 changes to 1 files (+1 heads)
#--------------------
# What's in the original?
#--------------------
/b$ cd ../a/
/a$ hg log --graph
o changeset: 4:c8e2025d2e3e
| branch: baloo
| tag: tip
| user: ggherdov
| date: Wed Aug 21 09:00:36 2013 +0200
| summary: named branch
|
o changeset: 3:8cff4324ef93
| parent: 0:77e4f693e2b8
| user: ggherdov
| date: Wed Aug 21 09:00:15 2013 +0200
| summary: bar
|
| @ changeset: 2:38def5fb8881
| | branch: baloo
| | user: ggherdov
| | date: Wed Aug 21 09:00:50 2013 +0200
| | summary: named branch
| |
| o changeset: 1:d821986392c0
|/ user: ggherdov
| date: Wed Aug 21 09:00:43 2013 +0200
| summary: baz
|
o changeset: 0:77e4f693e2b8
user: ggherdov
date: Wed Aug 21 09:00:05 2013 +0200
summary: foo
#--------------------
# Query for branches
#--------------------
/a$ hg branches
baloo 4:c8e2025d2e3e
default 3:8cff4324ef93 (inactive)
#--------------------
# It sees only one.
# If you repeat the whole procedure
# giving two different names to the branches,
# `hg branches` would show the two branches correctly.
#--------------------
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list