comparison 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
comparison
equal deleted inserted replaced
4509:9d1380e5c8c5 4510:e0bc2c575044
435 b = c.branch() 435 b = c.branch()
436 partial[b] = c.node() 436 partial[b] = c.node()
437 437
438 def lookup(self, key): 438 def lookup(self, key):
439 if key == '.': 439 if key == '.':
440 key = self.dirstate.parents()[0] 440 key, second = self.dirstate.parents()
441 if key == nullid: 441 if key == nullid:
442 raise repo.RepoError(_("no revision checked out")) 442 raise repo.RepoError(_("no revision checked out"))
443 if second != nullid:
444 self.ui.warn(_("warning: working directory has two parents, "
445 "tag '.' uses the first\n"))
443 elif key == 'null': 446 elif key == 'null':
444 return nullid 447 return nullid
445 n = self.changelog._match(key) 448 n = self.changelog._match(key)
446 if n: 449 if n:
447 return n 450 return n