changeset 6809:89ec85aa6cc3

context: trigger missing username warning only when necessary
author Patrick Mezard <pmezard@gmail.com>
date Sun, 20 Jul 2008 19:09:00 +0200
parents 6a9025a667ae
children 8f7a2915170a
files mercurial/context.py
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Jul 18 12:31:40 2008 +0200
+++ b/mercurial/context.py	Sun Jul 20 19:09:00 2008 +0200
@@ -472,10 +472,7 @@
             self._date = util.parsedate(date)
         else:
             self._date = util.makedate()
-        if user:
-            self._user = user
-        else:
-            self._user = self._repo.ui.username()
+        self._user = user
         if parents:
             self._parents = [changectx(self._repo, p) for p in parents]
         if changes:
@@ -543,7 +540,7 @@
 
     def manifest(self): return self._manifest
 
-    def user(self): return self._user
+    def user(self): return self._user or self._repo.ui.username()
     def date(self): return self._date
     def description(self): return self._text
     def files(self):
@@ -703,7 +700,7 @@
         self._node = None
         self._text = text
         self._date = date and util.parsedate(date) or util.makedate()
-        self._user = user or self._repo.ui.username()
+        self._user = user
         parents = [(p or nullid) for p in parents]
         p1, p2 = parents
         self._parents = [changectx(self._repo, p) for p in (p1, p2)]
@@ -726,7 +723,7 @@
     def __nonzero__(self):
         return True
 
-    def user(self): return self._user
+    def user(self): return self._user or self._repo.ui.username()
     def date(self): return self._date
     def description(self): return self._text
     def files(self): return self.modified()