Commits

Nathan Durnan committed 31448bd

Initial Attempt at making hooks work.
See item 7 and 8 @bitbucket

Comments (0)

Files changed (1)

 #	This is the FIRST callback that is executed when intializing this extension.
 #==============================================================================
 def uisetup(ui):
-	ui.debug('* Loading TimeStampMod uisetup\n')
+	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)
 	pass
 #_ end of uisetup _____________________________________________________________
 
 #	It can be used to access other extensions that this one may depend on.
 #==============================================================================
 def extsetup(ui):
-	ui.debug('* Loading TimeStampMod extsetup\n')
+	ui.debug('* Loading TimestampMod extsetup\n')
 	pass
 #_ end of extsetup ____________________________________________________________
 
 #	It can be used to setup any local state the extension might need.
 #==============================================================================
 def reposetup(ui, repo):
-	ui.debug('* Loading TimeStampMod reposetup\n')
+	ui.debug('* Loading TimestampMod reposetup\n')
 	pass
 #_ 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):
+	timestamp_mod(repo.ui, repo, **dict({'save': None, 'restore': True}))
+
+
 #==============================================================================
 # timestamp_mod 
 #------------------------------------------------------------------------------