# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1268833465 -32400
# Branch stable
# Node ID 1faea2aff22f4d56015ef2dafbba715d55b7bac2
# Parent  a601fded0309930ce0441bcfd667e8ba964b4bfa
hgemail: set "from" address in the same manner as patchbomb

patchbomb falls back to ui.username() if email.from not specified.

diff --git a/tortoisehg/hgtk/hgemail.py b/tortoisehg/hgtk/hgemail.py
--- a/tortoisehg/hgtk/hgemail.py
+++ b/tortoisehg/hgtk/hgemail.py
@@ -211,11 +211,21 @@ class EmailDialog(gtk.Window):
             self.repo = None
             return
 
+        def getfromaddr(ui):
+            """Get sender address in the same manner as patchbomb"""
+            addr = ui.config('email', 'from') or ui.config('patchbomb', 'from')
+            if addr:
+                return addr
+            try:
+                return repo.ui.username()
+            except error.Abort:
+                return ''
+
         if initial:
             # Only zap these fields at startup
             self._tobox.child.set_text(hglib.fromutf(repo.ui.config('email', 
'to', '')))
             self._ccbox.child.set_text(hglib.fromutf(repo.ui.config('email', 
'cc', '')))
-            self._frombox.child.set_text(hglib.fromutf(repo.ui.config('email', 
'from', '')))
+            self._frombox.child.set_text(hglib.fromutf(getfromaddr(repo.ui)))
             self._subjbox.child.set_text(hglib.fromutf(repo.ui.config('email', 
'subject', '')))
             self.tooltips.set_tip(self._eventbox,
                     _('Patch series description is sent in initial summary'

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to