context: trigger missing username warning only when necessary
authorPatrick Mezard <pmezard@gmail.com>
Sun, 20 Jul 2008 19:09:00 +0200
changeset 6809 89ec85aa6cc3
parent 6808 6a9025a667ae
child 6810 8f7a2915170a
context: trigger missing username warning only when necessary
mercurial/context.py
--- 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()