diff mercurial/localrepo.py @ 4510:e0bc2c575044

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.
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 06 Jun 2007 19:05:18 +0200
parents 22ebd6ee5672
children 96d8a56d4ef9
line wrap: on
line diff
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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)