changeset 6736:369ddc9c0339

lookup: optimize '.' Remove error messages as behavior is documented in hg help revs
author Matt Mackall <mpm@selenic.com>
date Wed, 25 Jun 2008 17:33:34 -0500
parents 8b09b0864781
children 7239e06e58e9
files mercurial/localrepo.py tests/test-log.out tests/test-merge-remove.out
diffstat 3 files changed, 1 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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