1. Nathan Durnan
  2. TimeStampMod

Commits

Nathan Durnan  committed b62b01e

Check for timestamp file exists before trying to read it.
See Issue #36 at BitBucket.

  • Participants
  • Parent commits 496a1c1
  • Branches BBI#36 - Check Timestamp File Exists

Comments (0)

Files changed (2)

File .hgtimestamp

View file
 "Tests/BBI36_Test.bat": {"timestamp": 1341533372.44},
 "Tests/TimestampMod_BBI37_Test.bat": {"timestamp": 1341343207.95},
 "TimeStampMod.png": {"timestamp": 1305052883.0},
-"TimestampMod.py": {"timestamp": 1341339063.7},
+"TimestampMod.py": {"timestamp": 1341533391.67},
 "TimeStampMod.xmind": {"timestamp": 1306451621.66},
 "TimestampMod_LastRecord": {"timestamp": 0}
 }

File TimestampMod.py

View file
 # end help text
 #==============================================================================
 # TimestampMod.py - Automatically save and restore the modification times of files
-File_Version = '0.2.6.0702'	# Version number definition
+File_Version = '0.2.6.0705'	# Version number definition
 # --> !!BETA RELEASE!!! <--
 # Copyright 2011-2012 Nathan Durnan <nedmech@gmail.com>
 #
 	'''Read data from Timestamp JSON Record File.'''
 	myTimeStampJSONFile = ''
 	myErr = False #initialize as boolean
+	if not os.path.exists(repo.wjoin(IN_TimestampFileName)):
+		# No file to read from, so just return and treat it as an error.
+		# If saving, a new file will be created.
+		# If restoring, nothing more can be done without the file data.
+		return True
+	# end of check for existing file
 	try:
 		myTimeStampJSONFile = open(repo.wjoin(IN_TimestampFileName), 'r')
 		repo.ui.debug('______\nRetrieving timestamps from JSON record file:\n------\n')