lookup: optimize '.'
Remove error messages as behavior is documented in hg help revs
--- a/mercurial/localrepo.py Wed Jun 25 12:53:57 2008 -0700
+++ b/mercurial/localrepo.py Wed Jun 25 17:33:34 2008 -0500
@@ -442,12 +442,7 @@
def lookup(self, key):
if key == '.':
- 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"))
+ return self.dirstate.parents()[0]
elif key == 'null':
return nullid
n = self.changelog._match(key)
--- a/tests/test-log.out Wed Jun 25 12:53:57 2008 -0700
+++ b/tests/test-log.out Wed Jun 25 17:33:34 2008 -0500
@@ -150,7 +150,6 @@
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
--- a/tests/test-merge-remove.out Wed Jun 25 12:53:57 2008 -0700
+++ b/tests/test-merge-remove.out Wed Jun 25 17:33:34 2008 -0500
@@ -23,7 +23,6 @@
M foo1
foo
% reverting foo1 and bar
-warning: working directory has two parents, tag '.' uses the first
saving current version of bar as bar.orig
reverting bar
saving current version of foo1 as foo1.orig