Is it possible to setup VisualHg such that i’m automatically presented with a commit screen every time I quit Visual studio 2010?
This would be extremely useful if I forget to commit some changes.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve managed to do this using the following steps:
This gives you a file which is set up to handle IDE events. Before the last
End Modulein the file add the following code:This will execute the commit action before the solution closes (which will happen before Visual Studio closes) but VS doesn’t wait for the commit window to close before carrying on. This isn’t ideal as it means that you’d have to re-load the solution if you wanted to make any changes before committing.
An alternative solution would be to handle the
QueryCloseSolutionevent and ask the user if they want to commit their changes before closing. If they answer “Yes” then you’d cancel the close solution (by setting the passed in boolean to beTrue) and callDTE.ExecuteCommand("File.Commit"). That would then leave the solution open whilst you did your commit but would ask you if you wanted to commit every time you close the solution.Taking that solution further would involve launching
hg statusfrom theQueryCloseSolutionevent to check if there are outstanding changes before asking the user if they want to commit their changes.