Commits

Nathan Durnan committed fbca7e7 Merge

Merge with BBI#36 - Check Timestamp File Exists

  • Participants
  • Parent commits c438c46, 6a0f81c
  • Branches development

Comments (0)

Files changed (3)

 {
-"Version": "0.2.6.0702",
+"Version": "0.2.6.0705",
 "FileData":{
 ".hgignore": {"timestamp": 1336516662.38},
 ".hgtags": {"timestamp": 1327960909.75},
 "README.md": {"timestamp": 1341343670.83},
+"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}
 }

Tests/BBI36_Test.bat

+::------------------------------------------------------------------------------
+:: Tests for BitBucket Issue #36 - Quiet Check for Existing Timestamp File.
+:: The message "*** Error accessing .hgtimestamp file! ***" is too strong.
+:: The file will be recreated if it is missing.  No message needed.
+::------------------------------------------------------------------------------
+:: This test-script creates a temporary test repository,
+:: creates and addes a single file, and commits the file.
+::------------------------------------------------------------------------------
+@echo off
+echo.
+echo ===========================================
+echo Test #1 - New Repository - Commit Normally.
+echo.
+echo ----------
+echo Initializing Test Repository...
+if exist testrepo rmdir /S /Q testrepo
+mkdir testrepo
+cd testrepo
+hg init
+echo Create file (abc.txt)
+echo "abc" > abc.txt
+hg add abc.txt
+echo hg commit -m "abc"
+hg commit -m "abc"
+echo --------------------------------------------
+echo CHECK: no error message should be displayed.
+echo ============================================
+pause
+echo.
+echo.
+echo =============================================
+echo Test #2 - New Repository - Commit w/ --debug.
+echo.
+echo ----------
+echo Initializing Test Repository...
+if exist testrepo rmdir /S /Q testrepo
+mkdir testrepo
+cd testrepo
+hg init
+echo Create file (abc.txt)
+echo "abc" > abc.txt
+hg add abc.txt
+echo hg commit -m "abc" --debug
+hg commit -m "abc" --debug
+echo --------------------------------------------
+echo CHECK: no error message should be displayed,
+echo        just a simple notification message.
+echo ============================================
+pause
 # 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')