Commits

Nathan Durnan committed 1194fa0

Refactor File Modification Timestamp retrieval code.
See issue 9 @bitbucket

  • Participants
  • Parent commits fa63c22
  • Branches development

Comments (0)

Files changed (1)

 		#end of clear dropped items.
 		#update timestamps for changed items.
 		for s_fileName in L_changed:
-			s_filePath = repo.wjoin(s_fileName)
-			f_fileModTime = TimeStamp_dict[s_fileName] = float(os.stat(s_filePath).st_mtime)
+			TimeStamp_dict[s_fileName] = _get_fileModTime(repo, s_fileName)
 			flag_Update = True
-			ui.status(time.strftime("%Y.%m.%d %H:%M:%S", time.localtime(f_fileModTime)), " \t", s_fileName, "\n")
 		#end of updating changed items.
 		#Save new file data.
 		file_TimeStampRecords = file(repo.root+'/.hgtimestamp', 'w')
 		for s_fileName, f_fileModTime in TimeStamp_dict.items():
 			if (f_fileModTime<=0):
-				s_filePath = repo.wjoin(s_fileName)
-				f_fileModTime = TimeStamp_dict[s_fileName] = float(os.stat(s_filePath).st_mtime)
-				ui.status(time.strftime("%Y.%m.%d %H:%M:%S", time.localtime(f_fileModTime)), " \t", s_fileName, "\n")
+				#fill in missing any timestamps.
+				TimeStamp_dict[s_fileName] = _get_fileModTime(repo, s_fileName)
 			#end of check for valid timestamp
 			file_TimeStampRecords.write("%s,%s\n" % (s_fileName, f_fileModTime))
 		#end of save new file data
 }
 #_ end of cmdtable ____________________________________________________________
 
+#==============================================================================
+# _get_fileModTime() Function Definition
+#------------------------------------------------------------------------------
+# Summary: Return a UTC timestamp value for the specified file's modified time.
+#==============================================================================
+def _get_fileModTime(repo, myFileName):
+	'''Retrieve the Modification Timestamp for the specified file.'''
+	s_filePath = repo.wjoin(myFileName)
+	f_fileModTime = float(os.stat(s_filePath).st_mtime)
+	repo.ui.status(time.strftime("%Y.%m.%d %H:%M:%S", time.localtime(f_fileModTime)), " \t", myFileName, "\n")
+	return f_fileModTime
+#_ end of _get_fileModTime ____________________________________________________
 
 
-