changeset 24:9ebd6d65b6c1

Simplified repository initialisation verification. IN: -
author John Schneiderman <JohnMS@CodeGNU.com>
date Tue, 29 Jul 2014 22:01:25 -0500
parents b18cd3cb2c09
children 5aaaa084fabd
files src/config.py src/manager.py
diffstat 2 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/config.py	Tue Jul 29 19:23:38 2014 -0500
+++ b/src/config.py	Tue Jul 29 22:01:25 2014 -0500
@@ -61,7 +61,7 @@
 		from ConfigParser import SafeConfigParser, Error
 
 		self.__parser = SafeConfigParser()
-		if len(self.__parser.read(path)) == 0:
+		if not self.__parser.read(path):
 			raise Error("Failed to find configuration file.")
 
 		if self.__parser.has_section('Mercurial'):
--- a/src/manager.py	Tue Jul 29 19:23:38 2014 -0500
+++ b/src/manager.py	Tue Jul 29 22:01:25 2014 -0500
@@ -48,11 +48,10 @@
 		return False
 
 	# Create the requested repository.
-	status = __addRepository(repository)
-	if 0 == status:
+	if __addRepository(repository):
 		print "Initialised repository directory."
 	else:
-		print >>sys.stderr, "Failed to create repository directory. OS Error Code:", status
+		print >>sys.stderr, "Failed to create repository directory."
 		return False
 
 	# Fill out the details of about the repository.
@@ -314,11 +313,11 @@
 	import os
 
 	try:
-		return subprocess.call([settings.HgCommand, "init", settings.RepositoryPath + os.sep + repo.StorageName])
+		statusCode = subprocess.call([settings.HgCommand, 'init', settings.RepositoryPath + os.sep + repo.StorageName])
 	except OSError as e:
 		print >>sys.stderr, "Initialisation error({0}): {1}".format(e.errno, e.strerror)
 		return False
-	return True
+	return (0 == statusCode)
 
 def __writeRepositoryDetails(repo):
 	""" Writes the details of a repository to the repository's