# HG changeset patch # User John Schneiderman # Date 1406642877 18000 # Node ID 32dc46f22c2a5c0504111f0e8bf7347212a46cfc # Parent ab317a52e5b4ce7cec06c9dcbbc7b04971d117e4 Fixed issue with Windows temporary file locking. IN: - diff -r ab317a52e5b4 -r 32dc46f22c2a doc/ChangeLog --- a/doc/ChangeLog Mon Jul 28 18:48:13 2014 -0500 +++ b/doc/ChangeLog Tue Jul 29 09:07:57 2014 -0500 @@ -17,8 +17,9 @@ *** You should have received a copy of the GNU Affero General Public License*** *** along with this program. If not, see . *** ******************************************************************************** -2014-07-28 John Schneiderman 0.2.1 +2014-07-29 John Schneiderman 0.2.1 - Fixed issue where the configuration file copy started before it closed. +- Fixed issue in Windows locking temporary file and preventing copying. 2014-07-26 John Schneiderman 0.2.0 - Ability to modify an existing repository. - Load a managed repository object from it's storage name. diff -r ab317a52e5b4 -r 32dc46f22c2a src/manager.py --- a/src/manager.py Mon Jul 28 18:48:13 2014 -0500 +++ b/src/manager.py Tue Jul 29 09:07:57 2014 -0500 @@ -258,7 +258,9 @@ import shutil foundRepo=False - with tempfile.NamedTemporaryFile() as target: + tempFile=None + with tempfile.NamedTemporaryFile(delete=False) as target: + tempFile = target.name with open(settings.HgWebPath + os.sep + 'hgweb.config', 'r') as source: for line in source: if repo.StorageName in line: @@ -270,7 +272,12 @@ while not source.closed: print "Waiting three seconds for configuration to close." time.sleep(3) - shutil.copy2(target.name, settings.HgWebPath + os.sep + 'hgweb.config') + try: + shutil.copy2(tempFile, settings.HgWebPath + os.sep + 'hgweb.config') + except IOError as e: + print >>sys.stderr, "Unregister error({0}): {1}".format(e.errno, e.strerror) + foundRepo = False + os.remove(tempFile) return foundRepo def __removeRepository(repo):