changeset 453:f2ab2cdd000b authfile_refactor

Associate username with pathless URL, as well as password
author Chris Cannam
date Wed, 29 Jun 2011 15:37:11 +0100
parents d0b7dbc3ba46
children 6f5acaf27d60
files easyhg.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/easyhg.py	Wed Jun 29 15:27:01 2011 +0100
+++ b/easyhg.py	Wed Jun 29 15:37:11 2011 +0100
@@ -4,8 +4,8 @@
 #
 #    Based on hgExplorer by Jari Korhonen
 #    Copyright (c) 2010 Jari Korhonen
-#    Copyright (c) 2010 Chris Cannam
-#    Copyright (c) 2010 Queen Mary, University of London
+#    Copyright (c) 2010-2011 Chris Cannam
+#    Copyright (c) 2010-2011 Queen Mary, University of London
 #    
 #    This program is free software; you can redistribute it and/or
 #    modify it under the terms of the GNU General Public License as
@@ -129,7 +129,8 @@
         return "%s://%s" % (parsed.scheme, parsed.netloc)
 
     def load_config(self):
-        self.auth_config = ConfigParser.RawConfigParser()
+        if not self.auth_config:
+            self.auth_config = ConfigParser.RawConfigParser()
         fp = None
         try:
             fp = open(self.auth_file)
@@ -188,7 +189,7 @@
         return hx
     
     def remote_user_key(self):
-        return self.remote_key(self.argless_url(), '')
+        return self.remote_key(self.pathless_url(), '')
     
     def remote_passwd_key(self):
         return self.remote_key(self.pathless_url(), self.user)
@@ -213,8 +214,9 @@
 
     def save_auth_data(self):
 
+        self.load_config()
         if not self.auth_config: return
-
+    
         self.set_to_config('preferences', 'remember', self.remember)
 
         self.ui.write('aiming to store details for user %s\n' % self.user)