mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
Issue a warning if "-r ." is used with two working directory parents.
Rationale for not aborting instead: The first parent is usually more important as it is the local branch during a merge and commands like 'hg diff' and 'hg diff -r.' behave still identically (except for the warning of course). Added a test for log -r. with one and two parents.
This commit is contained in:
parent
df8762ba4d
commit
cf1ee4e625
@ -437,9 +437,12 @@ class localrepository(repo.repository):
|
||||
|
||||
def lookup(self, key):
|
||||
if key == '.':
|
||||
key = self.dirstate.parents()[0]
|
||||
key, second = self.dirstate.parents()
|
||||
if key == nullid:
|
||||
raise repo.RepoError(_("no revision checked out"))
|
||||
if second != nullid:
|
||||
self.ui.warn(_("warning: working directory has two parents, "
|
||||
"tag '.' uses the first\n"))
|
||||
elif key == 'null':
|
||||
return nullid
|
||||
n = self.changelog._match(key)
|
||||
|
@ -47,6 +47,7 @@ hg log -pv d
|
||||
# log --follow tests
|
||||
hg init ../follow
|
||||
cd ../follow
|
||||
|
||||
echo base > base
|
||||
hg ci -Ambase -d '1 0'
|
||||
|
||||
@ -71,8 +72,15 @@ hg log -f -r 1:tip
|
||||
|
||||
hg up -C 3
|
||||
hg merge tip
|
||||
|
||||
echo % log -r . with two parents
|
||||
hg log -r .
|
||||
|
||||
hg ci -mm12 -d '1 0'
|
||||
|
||||
echo % log -r . with one parent
|
||||
hg log -r .
|
||||
|
||||
echo postm >> b1
|
||||
hg ci -Amb1.1 -d'1 0'
|
||||
|
||||
|
@ -144,6 +144,23 @@ summary: b1
|
||||
2 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
(branch merge, don't forget to commit)
|
||||
% log -r . with two parents
|
||||
warning: working directory has two parents, tag '.' uses the first
|
||||
changeset: 3:e62f78d544b4
|
||||
parent: 1:3d5bf5654eda
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:01 1970 +0000
|
||||
summary: b1
|
||||
|
||||
% log -r . with one parent
|
||||
changeset: 5:302e9dd6890d
|
||||
tag: tip
|
||||
parent: 3:e62f78d544b4
|
||||
parent: 4:ddb82e70d1a1
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:01 1970 +0000
|
||||
summary: m12
|
||||
|
||||
% log --follow-first
|
||||
changeset: 6:2404bbcab562
|
||||
tag: tip
|
||||
|
Loading…
Reference in New Issue
Block a user