Nathan Durnan committed 63963c9

Hooks almost working.
See issues 7 and 8 @bitbucket.

* Command-line seems to work, but TortoiseHG requires [hooks] section
in config file to be configured to work right.
* Still not adding the .hgtimestamp update from within TortoiseHG.

Comments (0)

Files changed (1)

 import os	#required for filesystem access methods.
 import time	#required for time functions.
+from mercurial import commands	#required for Mercurial commands.
 #_ end of imported modules_____________________________________________________
 	ui.debug('* Loading TimestampMod uisetup\n')
 	ui.setconfig("hooks", "pre-commit.TimestampMod", Pre_Commit_Hook)
 	ui.setconfig("hooks", "post-status.TimestampMod", Post_Status_Hook)
-	ui.setconfig("hooks", "post-update.TimestampMod", Post_Update_Hook)
 #_ end of uisetup _____________________________________________________________
 def reposetup(ui, repo):
 	ui.debug('* Loading TimestampMod reposetup\n')
-	pass
+	ui.setconfig("hooks", "update.TimestampMod", Update_Hook)
 #_ end of reposetup ___________________________________________________________
 def Pre_Commit_Hook(repo, **kwargs):
 	timestamp_mod(repo.ui, repo, **dict({'save': True, 'restore': None}))
-	pass
 def Post_Status_Hook(repo, **kwargs):
 	timestamp_mod(repo.ui, repo, **dict({'save': None, 'restore': None}))
-def Post_Update_Hook(repo, **kwargs):
+def Update_Hook(repo, **kwargs):
 	timestamp_mod(repo.ui, repo, **dict({'save': None, 'restore': True}))
 		#end of update timestamps for changed items or missing timestamps.
 		file_TimeStampRecords.write("%s,%s\n" % (s_fileName, f_fileModTime))
 	#end of loop through dictionary items.
+	#Make sure to close the file!
+	#Make sure to add the modified record file to the repository!
+	# Note: this may generate a warning "already tracked!" message.
+	commands.add(repo.ui, repo,
 #_ end of _save_Timestamps ____________________________________________________