Nathan Durnan  committed 8d54a56

Use repo[None].add method instead of commands.add method.
See Issue #19 at BitBucket.
This is the same method used in to add in the '.hgtags' file.

  • Participants
  • Parent commits 9f58c09
  • Branches BBI#19

Comments (0)

Files changed (2)

File .hgtimestamp



 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.
 from mercurial import scmutil	#required for "match" object in commit wrapper.
 #_ end of imported modules_____________________________________________________
 #	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, extra={}):
-	repo.ui.note('Wrap_Commit accessed!\n')
+	repo.ui.note('TimestampMod|Wrap_Commit accessed!\n')
 	#Check for a merge-commit. 
 	#  Don't run timestamp code on merge.
 	if (len(repo.parents()) > 1):
 		# End of check for non-existent match object.
 		myList_Match = list()
-		myList_Match = match.files() + [File_TimestampRecords]
+		myList_Match = match.files() #don't add timestamp file here, it will be added later.
 		timestamp_mod(repo.ui, repo, **dict({'save': True, 'restore': None, 'match': myList_Match}))
 		# 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)
+			repo[None].add([File_TimestampRecords]) #same method used for adding '.hgtags' file in
 		#end of check for record file in repository.
 		#Update match fileset for use under TortoiseHg.
 		#  TortoiseHg doesn't seem to catch the updated file
 		# end of check for record file.
 		repo.ui.debug('Match Files: ', str(match.files()), '\n')
 	#end of check for merge-commit.
+	repo.ui.note('TimestampMod|Wrap_Commit finished!\n')
 	return repo.timestamp_origcommit(text, user, date, match, force, editor, extra)
 #_ end of Wrap_Commit _________________________________________________________