1. Nathan Durnan
  2. TimeStampMod


Nathan Durnan  committed 056730d Merge

Merge with hotfixes

  • Participants
  • Parent commits e257553, 2bc9d11
  • Branches default
  • Tags Version 0.0.2

Comments (0)

Files changed (1)

File TimestampMod.py

View file
 import os	#required for filesystem access methods.
 import time	#required for time functions.
 from mercurial import localrepo	#required for creating a pseudo-pre-commit hook.
+from mercurial import commands	#required for accessing Mercurial commands.
 #_ end of imported modules_____________________________________________________
 # 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 
-#	actions are executed.  Normal pre-commit hooks and extension.wrapcommand()
+#	actions are executed.  Normal pre-commit hooks and extensions.wrapcommand()
 #	 methods failed to work with the version of TortoiseHg used for development 
 #	(v2.0.4).  Ideally, this will be revised to a cleaner method in the future.
 	# End of check for non-existent match object.
 	List_CommitMatch = myMatch.files() + [File_TimestampRecords]
 	timestamp_mod(repo.ui, repo, **dict({'save': True, 'restore': None}))
-	# Make sure record file is part of commit. 
+	# Make sure record file is part of repository and commit. 
+	if not File_TimestampRecords in repo.dirstate:
+		repo.ui.debug('Wrap_Commit: ', File_TimestampRecords, ' not in repo.dirstate  Adding...\n')
+		commands.add(repo.ui, repo, File_TimestampRecords)
+	#end of check for record file in repository.
+	#Update match fileset for use under TortoiseHg.
+	#  TortoiseHg doesn't seem to catch the updated file
+	#  unless it is manually added to the match fileset.
 	if File_TimestampRecords in myMatch.files():
 		# Don't need to do anything if record file already in commit.
+		repo.ui.debug('Wrap_Commit: ', File_TimestampRecords, ' already in match\n')
 		# Add the record file to the match object.