Commits

domainfun  committed 4d09605

Removed trailing spaces in TimestampMod.py (PEP8: W291 trailing whitespace).

  • Participants
  • Parent commits a046313
  • Branches PEP8 Compliance

Comments (0)

Files changed (2)

File .hgtimestamp

 "Tests/BBI42_CommitSubrepos.bat": {"timestamp": 1382377562.63},
 "Tests/BBI42_CommitSubrepos.sh": {"timestamp": 1383755553.22},
 "TimeStampMod.png": {"timestamp": 1305052883.0},
-"TimestampMod.py": {"timestamp": 1385307354.0},
+"TimestampMod.py": {"timestamp": 1386326304.0},
 "TimeStampMod.xmind": {"timestamp": 1306451621.66},
 "TimestampMod_LastRecord": {"timestamp": 0}
 }

File TimestampMod.py

 '''Automatically store and retrieve file modification times.'''
 # end help text
 #=============================================================================
-# TimestampMod.py - Automatically save and restore file modification times 
+# TimestampMod.py - Automatically save and restore file modification times
 File_Version = '0.2.8'  # Version number definition
 # --> !!BETA RELEASE!!! <--
 # Copyright 2011-2013 Nathan Durnan <nedmech@gmail.com>
 #=============================================================================
 # uisetup Callback Configuration
 #-----------------------------------------------------------------------------
-# NOTES: Called when the extension is first loaded and receives a ui object.  
+# NOTES: Called when the extension is first loaded and receives a ui object.
 #	This is the FIRST callback executed when intializing this extension.
 #=============================================================================
 def uisetup(ui):
 	# Hook_Pre_Commit is depreciated in favor of Wrap_Commit method
 	#	(Wrap_Commit works with both native Mercurial and TortoiseHg.)
 	'''ui.setconfig("hooks", "pre-commit.TimestampMod", Hook_Pre_Commit)'''
-	#NOTE: the post-merge, post-resolve, and post-revert hooks are not picked up 
-	#  by TortoiseHg.  When using this extension with TortoiseHg, these hooks 
-	#  must be manually added to the "mercurial.ini" configuration file.  
+	#NOTE: the post-merge, post-resolve, and post-revert hooks are not picked up
+	#  by TortoiseHg.  When using this extension with TortoiseHg, these hooks
+	#  must be manually added to the "mercurial.ini" configuration file.
 	#  Use the following format:
 	#    [hooks]
 	#    post-merge.TimestampMod = python:{path-to-TimestampMod.py}:Hook_Post_Merge
 	'''Initialize Repository-Level Callback'''
 	ui.debug('* Loading TimestampMod reposetup\n')
 	#Check for external Python library path in configuration
-	# NOTE: keep this in reposetup in case user has configured the 
+	# NOTE: keep this in reposetup in case user has configured the
 	#   extension to be used per-repository instead of globally.
 	#   This will ensure the path config can be picked up from
 	#   either the global config or the repository config.
 		'''This is a "dirty" method of wrapping the commit event so
 		pre-commit actions are executed.  Normal pre-commit hooks and
 		extension.wrapcommand() methods failed to work with the version
-		of TortoiseHg used for development.  Ideally, this will be 
+		of TortoiseHg used for development.  Ideally, this will be
 		revised to a cleaner method in the future.'''
 		localrepo.localrepository.timestamp_origcommit = \
 			localrepo.localrepository.commit
 #-----------------------------------------------------------------------------
 # Summary: Intercept the commit event to update the timestamp record file, and
 #	make sure the record file gets included in the commit.
-# NOTES: This is a "dirty" method of wrapping the commit event so pre-commit 
+# NOTES: This is a "dirty" method of wrapping the commit event so pre-commit
 #	actions are executed. Normal pre-commit hooks and extensions.wrapcommand()
-#	 methods failed to work with the TortoiseHg version used for development.  
+#	 methods failed to work with the TortoiseHg version used for development.
 #	Ideally, this will be revised to a cleaner method in the future.
 #=============================================================================
 def Wrap_Commit(
-		repo, 
-		text="", 
-		user=None, 
-		date=None, 
-		match=None, 
-		force=False, 
-		editor=False, 
+		repo,
+		text="",
+		user=None,
+		date=None,
+		match=None,
+		force=False,
+		editor=False,
 		extra={}):
 	repo.ui.note('______\nTimestampMod|Wrap_Commit accessed!\n')
-	#Check for a merge-commit. 
+	#Check for a merge-commit.
 	#  Don't run timestamp code until merge is complete.
 	if (len(repo.parents()) > 1):
 		repo.ui.status(
-			'TimestampMod|Wrap_Commit aborted', 
+			'TimestampMod|Wrap_Commit aborted',
 			' - Merge in progress\n'
 			)
 	else:
 		# End of check for non-existent match object.
 		#don't add timestamp file here, it will be added later.
 		timestamp_mod(
-			repo.ui, 
-			repo, 
+			repo.ui,
+			repo,
 			**dict({
-				'save': True, 
-				'restore': None, 
+				'save': True,
+				'restore': None,
 				'match': localmatch.files()
 				})
 			)
 		#Check for match conditions.
-		if ((match is None) or 
+		if ((match is None) or
 			(not match.files())):
 			#Similar to test for generic commit in hgext\largefiles\reposetup.py
 			repo.ui.debug('Wrap_Commit: no match specified\n')
 	#end of check for merge-commit.
 	repo.ui.note('TimestampMod|Wrap_Commit finished!\n______\n')
 	return repo.timestamp_origcommit(
-			text, 
-			user, 
-			date, 
-			match, 
-			force, 
-			editor, 
+			text,
+			user,
+			date,
+			match,
+			force,
+			editor,
 			extra
 			)
 #_ end of Wrap_Commit ________________________________________________________
 	myUnresolved = _check_Merge_unresolved(repo)
 	if myUnresolved:
 		repo.ui.note(
-			'TimestampMod|Post-Status Hook aborted', 
+			'TimestampMod|Post-Status Hook aborted',
 			' - Unresolved merge detected!\n'
 			)
 		return
 	#end check for unresolved merged
 	timestamp_mod(
-		repo.ui, 
-		repo, 
+		repo.ui,
+		repo,
 		**dict({
-			'save': None, 
+			'save': None,
 			'restore': None
 			})
 		)
 	repo.ui.note('______\nTimestampMod|Hook_Update accessed!\n')
 	if (len(repo.parents()) > 1):
 		repo.ui.note(
-			'TimestampMod|Hook_Update aborted', 
+			'TimestampMod|Hook_Update aborted',
 			'- Merge in progress\n'
 			)
 	else:
 		timestamp_mod(
-			repo.ui, 
-			repo, 
+			repo.ui,
+			repo,
 			**dict({
-				'save': None, 
+				'save': None,
 				'restore': True
 				})
 			)
 	myUnresolved = _check_Merge_unresolved(repo)
 	if myUnresolved:
 		repo.ui.note(
-			'TimestampMod|Post-Merge Hook aborted', 
+			'TimestampMod|Post-Merge Hook aborted',
 			' - Unresolved merge detected!\n'
 			)
 		return
 	if (not myPreview):
 		#only update timestamps if not just a preview.
 		timestamp_mod(
-			repo.ui, 
-			repo, 
+			repo.ui,
+			repo,
 			**dict({
-				'save': None, 
+				'save': None,
 				'restore': True
 				})
 			)
 	myUnresolved = _check_Merge_unresolved(repo)
 	if myUnresolved:
 		repo.ui.note(
-			'TimestampMod|Post-Resolve Hook aborted', 
+			'TimestampMod|Post-Resolve Hook aborted',
 			' - Unresolved merge detected!\n'
 			)
 		return
 		#Only re-apply timestamps if the timestamp file is being resolved.
 		repo.ui.status('Resolved timestamp file - Reapplying timestamps!\n')
 		timestamp_mod(
-			repo.ui, 
-			repo, 
+			repo.ui,
+			repo,
 			**dict({
-				'save': None, 
+				'save': None,
 				'restore': True
 				})
 			)
 
 def Hook_Post_Revert(repo, **kwargs):
 	'''NOTE: TortoiseHg Incompatibility Issue!
-	The Post-Revert hook does not work correctly for most of the Revert 
+	The Post-Revert hook does not work correctly for most of the Revert
 	commands from TortoiseHg (version 2.2.2 at the time of implementaion).
 	The hook simply does not fire from the methods used within TortoiseHg.
 	This issue has been brought to the attention of the TortoiseHg team and
 		bAll = kwargs['opts'].get('all', False)
 		listExclude = kwargs['opts'].get('exclude', list())
 		if kwargs['opts'].get('date'):
-			#Don't bother to check for rev-spec. 
-			# Original command would've failed and not 
+			#Don't bother to check for rev-spec.
+			# Original command would've failed and not
 			# gotten here if both date and rev were spec'd.
 			kwargs['opts']['rev'] = \
 				cmdutil.finddate(
-					repo.ui, 
-					repo, 
+					repo.ui,
+					repo,
 					kwargs['opts']['date']
 					)
 		#end of check for date specified.
 	maybeReverted = modified + added
 	#Create a temporary copy of the timestamp file from the source revision.
 	commands.cat(
-		repo.ui, 
-		repo, 
-		File_TimestampRecords, 
-		File_TimestampRecords, 
+		repo.ui,
+		repo,
+		File_TimestampRecords,
+		File_TimestampRecords,
 		**dict({
-			'rev':kwargs['opts']['rev'], 
+			'rev':kwargs['opts']['rev'],
 			'output':'%s.revert'
 			})
 		)
 			if os.path.isfile(myFileName):
 				TimeStamp_dict[myFileName] = -1
 			elif os.path.isdir(myFileName):
-				#Check the potential list of reverted files 
+				#Check the potential list of reverted files
 				# against the directory path pattern.
 				for sFile in sorted(maybeReverted):
 					if fnmatch.fnmatch(sFile, (myFileName + '/*')):
 	#end of check for 'all' flag
 	# Retrieve existing timestamps from the record file.
 	myErr = _read_TimestampJSONRecords(
-				repo, 
-				(File_TimestampRecords + '.revert'), 
+				repo,
+				(File_TimestampRecords + '.revert'),
 				TimeStamp_dict
 				)
 	if (not bDryRun):
 		os.unlink(repo.wjoin(File_TimestampRecords + '.revert'))
 	except:
 		repo.ui.status(
-			'Post-Revert: ', 
+			'Post-Revert: ',
 			'error deleting temporary timestamp file!\n'
 			)
 	#end of deleting temporary timestamp file.
 
 
 #=============================================================================
-# timestamp_mod 
+# timestamp_mod
 #-----------------------------------------------------------------------------
 # Summary: save or restore file modification times.
 #
 		_get_RepoFileList(repo, myMatchList, TimeStamp_dict)
 	# Retrieve existing timestamps from the record file.
 	myErr = _read_TimestampJSONRecords(
-				repo, 
-				File_TimestampRecords, 
+				repo,
+				File_TimestampRecords,
 				TimeStamp_dict
 				)
 	# Check for command optional argument
 	if kwargs['save']:
 		_save_TimestampsJSON(
-				repo, 
-				File_TimestampRecords, 
-				myMatchList, 
-				myChangedList, 
-				myDroppedList, 
+				repo,
+				File_TimestampRecords,
+				myMatchList,
+				myChangedList,
+				myDroppedList,
 				TimeStamp_dict
 				)
-	elif not myErr: 
+	elif not myErr:
 		# Only evaluate Restore or Display if file was read.
 		if kwargs['restore']:
 			_restore_Timestamps(repo, TimeStamp_dict)
 		# end of check options (Restore/Display)
 	else:
 		repo.ui.debug(
-			'Timestamp_Mod can not continue without ', 
+			'Timestamp_Mod can not continue without ',
 			File_TimestampRecords, ' file!\n'
 			)
 	# end of check options
 #=============================================================================
 # Command Table Definition
 #-----------------------------------------------------------------------------
-# (NOTE: Keep this after command definitions.  cmdtable contents 
+# (NOTE: Keep this after command definitions.  cmdtable contents
 #		 must be defined after the commands/functions referenced!)
 #=============================================================================
 cmdtable = {
 	"timestamp_mod":
-		(timestamp_mod, 
+		(timestamp_mod,
 			[('s', 'save', None, ('save modification times')),
 			('r', 'restore', None, ('restore modification times'))
-			], 
+			],
 			('hg timestamp_mod [-s | -r]\n' +
 				'\n' + inspect.getfile(inspect.currentframe()) +
 				'\n  ' + '(Version ' + File_Version + ')')
 	try:
 		myModTime = float(os.stat(myFilePath).st_mtime)
 		repo.ui.debug(
-			time.strftime( 
-				'%Y.%m.%d %H:%M:%S', 
+			time.strftime(
+				'%Y.%m.%d %H:%M:%S',
 				time.localtime(myModTime)
-				), 
+				),
 			' \t', IN_FileName, '\n'
 			)
 		return myModTime
 	except:
 		repo.ui.warn(
-			'*** TimestampMod: Get File Stat failed for ', 
+			'*** TimestampMod: Get File Stat failed for ',
 			IN_FileName, '!\n'
 			)
 		repo.ui.debug('*** Exception: ', str(sys.exc_info()), '  ***\n')
 # Summary: Set the UTC timestamp value for the specified file's modified time.
 #=============================================================================
 def _set_fileModTime(
-		repo, 
-		IN_FileName, 
-		IN_ModTime 
+		repo,
+		IN_FileName,
+		IN_ModTime
 		):
 	'''Assign the Modification Timestamp for the specified file.'''
 	repo.ui.debug('set_mtime: ')
 	try:
 		myFileStat = os.stat(myFilePath)
 		os.utime(
-			myFilePath, 
-			(myFileStat.st_atime, 
+			myFilePath,
+			(myFileStat.st_atime,
 				type(myFileStat.st_mtime)(IN_ModTime)
 				)
 			)
 		repo.ui.debug(
-			time.strftime('%Y.%m.%d %H:%M:%S', 
+			time.strftime('%Y.%m.%d %H:%M:%S',
 				time.localtime(IN_ModTime)
-				), 
+				),
 			' \t', IN_FileName, '\n'
 			)
 	except:
 		repo.ui.warn(
-			'*** TimestampMod: Set File Stat failed for ', 
+			'*** TimestampMod: Set File Stat failed for ',
 			IN_FileName, '! ***\n'
 			)
 		repo.ui.debug('*** Exception: ', str(sys.exc_info()), '  ***\n')
 # _get_RepoFileList Function Definition
 #-----------------------------------------------------------------------------
 # Summary: Build lists of files in the Working Directory from the Repository
-#	Status entries.  Add active files (clean/added/modified) to the global 
+#	Status entries.  Add active files (clean/added/modified) to the global
 #	dictionary collection, andreturn lists containing changed files (added/
-#	modified) and dropped files(removed/deleted).  
+#	modified) and dropped files(removed/deleted).
 # NOTE: This function will CLEAR the contents of the global dictionary object
 #	and rebuild it from scratch.
 #=============================================================================
 def _get_RepoFileList(
-		repo, 
-		IN_ListMatch, 
+		repo,
+		IN_ListMatch,
 		OUT_TimeStamp_dict
 		):
 	'''Build lists of files from the repository status contents.'''
 	myFiles = IN_ListMatch + myChanged + clean
 	# Rebuild global dictionary collection
 	# Be sure to start with a clean collection.
-	OUT_TimeStamp_dict.clear() 
+	OUT_TimeStamp_dict.clear()
 	for myFile in myFiles:
 		if myFile not in myDropped:
-			#Only add non-dropped files to the list, 
+			#Only add non-dropped files to the list,
 			# even if they are part of the match list.
 			myFileName = str(myFile).strip()
 			# initialize dictionary entry
 #=============================================================================
 # _read_TimestampRecords Function Definition
 #-----------------------------------------------------------------------------
-# Summary: Read in the data from the Timestamp Record File and assign the 
+# Summary: Read in the data from the Timestamp Record File and assign the
 #	timestamps to their corresponding entries in the global file dictionary
 #	collection object.
 # NOTES:
-# * This method is to be kept in tact to deal with the original 
-#   CSV timestamp file format that may have been commited using 
+# * This method is to be kept in tact to deal with the original
+#   CSV timestamp file format that may have been commited using
 #   previous versions of this extension.  DO NOT LOSE this functionality!
 #=============================================================================
 def _read_TimestampRecords(
-		repo, 
-		IN_TimestampFileName, 
+		repo,
+		IN_TimestampFileName,
 		INOUT_TimeStamp_dict
 		):
 	'''Read data from Timestamp Record File.'''
 		myTimeStampRecordsFile = open(repo.wjoin(IN_TimestampFileName), 'r')
 	except:
 		repo.ui.warn(
-			'*** Error accessing ', 
-			IN_TimestampFileName, 
+			'*** Error accessing ',
+			IN_TimestampFileName,
 			' file! ***\n'
 			)
 		repo.ui.debug('*** Exception: ', str(sys.exc_info()), '  ***\n')
 	# end of opening record file.
 	repo.ui.debug('------ Retrieving timestamps from record file:\n')
 	for myLine in myTimeStampRecordsFile.readlines():
-		# Read the data from the line. 
+		# Read the data from the line.
 		# (CSV format: [FileName],[ModificationTime])
 		try:
 			myFileName, myModTime = myLine.strip().split(',')
 				#Make sure incoming data is properly formatted.
 				INOUT_TimeStamp_dict[str(myFileName)] = float(myModTime)
 				repo.ui.debug(
-					'UTC: ', myModTime, 
+					'UTC: ', myModTime,
 					'\t: ', myFileName, '\n'
 					)
 			# end of check file exists in dictionary.
 # NOTES:
 # * This method will fall back to use the previous CSV file read method if it
 #   can not read the file as JSON data.
-# * Many thanks to BitBucket user TAKAHIRO Kitahara (flied_onion) 
-#   (https://bitbucket.org/flied_onion) for huge contributions with 
+# * Many thanks to BitBucket user TAKAHIRO Kitahara (flied_onion)
+#   (https://bitbucket.org/flied_onion) for huge contributions with
 #   implementing and testing correct encoding for international support.
 #=============================================================================
 def _read_TimestampJSONRecords(
-		repo, 
-		IN_TimestampFileName, 
+		repo,
+		IN_TimestampFileName,
 		INOUT_TimeStamp_dict
 		):
 	'''Read data from Timestamp JSON Record File.'''
 		myTimeStampJSONFile = open(repo.wjoin(IN_TimestampFileName), 'rb')
 	except: #report errors
 		repo.ui.warn(
-			'*** Error opening ', 
-			IN_TimestampFileName, 
+			'*** Error opening ',
+			IN_TimestampFileName,
 			' file! ***\n'
 			)
 		repo.ui.debug('*** Exception: ', str(sys.exc_info()), '  ***\n')
 		try:
 			myData = json.loads(unicode(s_Content, testEncoding))
 		except:
-			repo.ui.debug( 
-				'*** ', testEncoding, ' Exception:\n', 
+			repo.ui.debug(
+				'*** ', testEncoding, ' Exception:\n',
 				str(sys.exc_info()), '\n***\n'
 				)
 			#move on to check next encoding.
 			break
 		# end of load attempt.
 	# end of loop through encoding list.
-	if not openedEncoding: 
+	if not openedEncoding:
 		# No encoding could be determined - Treat as failure.
 		# Allow error checking to try opening as CSV file.
 		repo.ui.debug('Failed to open as JSON file with available Encoding.\n')
 		# Try opening as a pre-v0.2.0 CSV file insted:
 		repo.ui.warn(
-			'Attempting to open ', 
-				IN_TimestampFileName, 
+			'Attempting to open ',
+				IN_TimestampFileName,
 				' as CSV file\n'
 				)
 		return _read_TimestampRecords(
-			repo, 
-			IN_TimestampFileName, 
+			repo,
+			IN_TimestampFileName,
 			INOUT_TimeStamp_dict
 			)
 	# Check for version and object data:
 			del myData['FileData'][LastPlaceholder]
 		myWarnCount = 0 #initialize counter.
 		for s_fileName, obj_fileData in myData['FileData'].items():
-			# Convert s_fileName encode (unicode) 
+			# Convert s_fileName encode (unicode)
 			# to sys.getfilesystemencoding()
 			s_fileName = s_fileName.encode(sys.getfilesystemencoding())
 			#Only import data for entries already in local dictionary.
 				myWarn = False #initialize warning flag for each item.
 				#Make sure incoming data is properly formatted.
 				if isinstance(obj_fileData, float):
-					# Keep this section for compatibility 
+					# Keep this section for compatibility
 					# with v0.2.1 timestamp file.
 					f_fileModTime = float(obj_fileData)
 					#myErr = False 	# no return flag as successful.
 						#myErr = False 	# no return flag as successful.
 					else: # Error - missing timestamp in dictionary.
 						# use explicitly invalid value if none found.
-						f_fileModTime = -1 
+						f_fileModTime = -1
 						myWarn = True
 						repo.ui.warn(
-							'WARNING: ', 
-							'Missing timestamp definition for ', 
-							str(s_fileName), ': ', 
+							'WARNING: ',
+							'Missing timestamp definition for ',
+							str(s_fileName), ': ',
 							str(obj_fileData), '\n'
 							)
 				else: # Error - not a recognized data type.
 					# use explicitly invalid value if none found.
-					f_fileModTime = -1 
+					f_fileModTime = -1
 					myWarn = True
 					repo.ui.warn(
-						'WARNING: Undefined data for ', 
-						str(s_fileName), ': ', 
-						str(type(obj_fileData)), 
+						'WARNING: Undefined data for ',
+						str(s_fileName), ': ',
+						str(type(obj_fileData)),
 						' = [', str(obj_fileData), ']\n'
 						)
 				# end of check for data type
 					INOUT_TimeStamp_dict[str(s_fileName)] = \
 						f_fileModTime
 					repo.ui.debug(
-						'UTC: ', str(f_fileModTime), 
+						'UTC: ', str(f_fileModTime),
 						'\t: ', str(s_fileName), '\n'
 						)
 				else:
 			# This is not an error condition.
 			# Likely just an empty working directory.
 			repo.ui.debug(
-				IN_TimestampFileName, 
-				' contains no file records', 
+				IN_TimestampFileName,
+				' contains no file records',
 				' - Working Directory is empty?\n'
 				)
 		elif (myWarnCount >= len(myData['FileData'])):
 			repo.ui.debug(
-				'ERROR: Could not read file data from ', 
+				'ERROR: Could not read file data from ',
 				IN_TimestampFileName, '\n'
 				)
 			myErr = True	# Error - could not find JSON data
 		# end of check warning count.
 	else: # JSON file data is not present
 		repo.ui.debug(
-			IN_TimestampFileName, 
+			IN_TimestampFileName,
 			' does not have JSON file data.\n'
 			)
 		myErr = True	# Error - could not find JSON FileData records
 # _save_TimestampsJSON Function Definition
 #-----------------------------------------------------------------------------
 # Summary: Save File Modified Timestamps for files in the global dictionary
-#	object to a JSON-formatted record file in the repository root directory. 
-#	New values for timestamps will be retrieved for files that have changed 
+#	object to a JSON-formatted record file in the repository root directory.
+#	New values for timestamps will be retrieved for files that have changed
 #	or are missing timestamp records in the first place.
 # NOTES:
 # * Many thanks to BitBucket user lboehler (https://bitbucket.org/lboehler)
-#	for suggesting using the SORTED list to build the timestamp file.  This 
-#	really should have been obvious, but I completely overlooked it!  
-# * The JSON file will be built manually instead of using the built-in JSON 
+#	for suggesting using the SORTED list to build the timestamp file.  This
+#	really should have been obvious, but I completely overlooked it!
+# * The JSON file will be built manually instead of using the built-in JSON
 #	methods.  This is because the dict object in Python can no be sorted well
 #	enough to generate a repeatable JSON file with the data in the same order
-#	all the time.  Maybe when Mercurial starts using Python 2.7+, the newer 
+#	all the time.  Maybe when Mercurial starts using Python 2.7+, the newer
 #	OrderedDict object type may be able to be used here.
 #=============================================================================
 def _save_TimestampsJSON(
-		repo, 
-		IN_TimestampFileName, 
-		IN_MatchList, 
-		IN_ChangedList, 
-		IN_DroppedList, 
+		repo,
+		IN_TimestampFileName,
+		IN_MatchList,
+		IN_ChangedList,
+		IN_DroppedList,
 		INOUT_TimeStamp_dict
 		):
 	'''Save File Modification Timestamps to JSON record file.'''
 	for s_fileName in sorted(INOUT_TimeStamp_dict.keys(), key=str.lower):
 		f_fileModTime = INOUT_TimeStamp_dict[s_fileName]
 		if (s_fileName in IN_ChangedList) or (f_fileModTime<=0):
-			# Make sure to only save new file timestamps if they have  
+			# Make sure to only save new file timestamps if they have
 			# been included in the commit (will be in the match list).
-			if ((f_fileModTime>0) and 
-					(len(IN_MatchList)>0) and 
+			if ((f_fileModTime>0) and
+					(len(IN_MatchList)>0) and
 					(s_fileName not in IN_MatchList)):
 				# Do not save new timestamp if file is not in match list.
 				pass
-			else: 
-				#File is in match list, 
+			else:
+				#File is in match list,
 				# or match list is empty (save all timestamps)
 				f_fileModTime = \
 					INOUT_TimeStamp_dict[s_fileName] = \
 		# end of update timestamps for changed items or missing timestamps.
 		if (s_fileName in IN_DroppedList) or (f_fileModTime<=0):
 			repo.ui.debug(
-				'...removing record of dropped file, ', 
-				'or file with missing timestamp ', 
+				'...removing record of dropped file, ',
+				'or file with missing timestamp ',
 				'(', s_fileName, ')\n'
 				)
 			del INOUT_TimeStamp_dict[s_fileName]
 		else:	#timestamp is valid
 			myTimeStampJSONFile.write(
-				'"%s": {"timestamp": %s},\n' 
+				'"%s": {"timestamp": %s},\n'
 				% (s_fileName, f_fileModTime)
 				)
 		# end of check for non-existing files or timestamps.
 	#Make sure the record file is in the repository.
 	if not (IN_TimestampFileName in repo.dirstate):
 		repo.ui.debug(
-			'_save_TimestampsJSON: ', 
-			IN_TimestampFileName, 
+			'_save_TimestampsJSON: ',
+			IN_TimestampFileName,
 			' not in repo.dirstate  Adding...\n'
 			)
 		#\/ same method used for adding '.hgtags' file in localrepo.py
-		repo[None].add([IN_TimestampFileName]) 
+		repo[None].add([IN_TimestampFileName])
 		repo.dirstate.rebuild #to pick up new record file state.
 	#end of check for record file in repository.
 #_ end of _save_TimestampsJSON _______________________________________________
 # _restore_Timestamps Function Definition
 #-----------------------------------------------------------------------------
 # Summary: Restore the File Modification Timestamp property for files in the
-#	global dictionary collection.  
+#	global dictionary collection.
 # NOTE: This presumes that the dictionary has been initialized and original
 #	timestamp data has already been read into the dictionary.
 #=============================================================================
 # _display_Timestamps Function Definition
 #-----------------------------------------------------------------------------
 # Summary: Default action. Display File Modification Timestamp property for
-#	files in the global dictionary collection.  
+#	files in the global dictionary collection.
 # NOTE: This presumes that the dictionary has been initialized and original
 #	timestamp data has already been read into the dictionary.
 #=============================================================================
 			# Valid timestamp detected!
 			# Display timestamp using local time adjustment.
 			repo.ui.note(
-				time.strftime('%Y.%m.%d %H:%M:%S', 
+				time.strftime('%Y.%m.%d %H:%M:%S',
 					time.localtime(f_fileModTime)
-					), 
+					),
 				' \t', s_fileName, '\n'
 				)
 		else:
 			# No valid timestamp recorded, skip this file.
 			repo.ui.debug(
-				s_fileName, 
+				s_fileName,
 				' - skipped - no timestamp recorded\n'
 				)
 		# end of check for valid timestamp.