Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8305395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:06:29+00:00 2026-06-08T18:06:29+00:00

On commit to repository I have a hook defined in Mercurial: [hooks] precommit.exportDB=exportDB.bat This

  • 0

On commit to repository I have a hook defined in Mercurial:

[hooks]
precommit.exportDB=exportDB.bat

This creates/updates a SQL-dump from my database, which should be included in the commit.
BUT: although this works, the Sql is marked as new, but not part of the now commiting changeset.
How can I automatically include it so it gets into the set of changed files?

Hope this makes sense…

Thx
Reinhard

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:06:29+00:00Added an answer on June 8, 2026 at 6:06 pm

    This’ll sound crazy, but you can do it in two steps. First change your precommit hook to a pre-commit hook — yup, both exist and they’re different. Without the dash the commit has already started and some lock has been acquired. With the dash it happens before the commit starts and you can still hg add the new file.

    On a unix like that total change would be:

    [hooks]
    pre-commit.exportDB=exportDB.sh && hg add resulting.sql
    

    presumably there’s something similar on Windows, or you could make the hg add the last line of the batch file.

    P.S. Don’t commit generated files. 🙂

    Update:

    I just tested this and it works as I suggested:

    ry4an@four:~$ hg init reinhard
    ry4an@four:~$ cd reinhard/
    ry4an@four:~/reinhard$ vi .hg/hgrc
    ry4an@four:~/reinhard$ cat .hg/hgrc 
    [hooks]
    pre-commit = hg add otherfile
    ry4an@four:~/reinhard$ echo text > afile
    ry4an@four:~/reinhard$ echo more > otherfile
    ry4an@four:~/reinhard$ hg add afile
    ry4an@four:~/reinhard$ hg status
    A afile
    ? otherfile
    ry4an@four:~/reinhard$ hg commit -m 'message'
    ry4an@four:~/reinhard$ hg status --all
    C afile
    C otherfile
    

    Notice that before the commit only ‘afile’ is added and ‘otherfile’ is unknown, and after the commit both files are ‘C’ (meaning “Clean’ — they’ve been added and committed).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using this hook with VisualSVN Server, added to the Repository/hooks folder as pre-commit.bat. My
My subversion repository has a pre-commit hook that requires all files to have a
I have repository on GitHub to which I commit regularly from my local computer.
Problem background I have a post-commit script for my SVN repository which archives &
I have my branch on my GIT repository where I used to commit and
I'm writing a pre-commit hook in C# and I know I have to return
On my remote git server, I have a pre-receive hook that will check-in (commit)
i have followed the pattern on this site to hook up ninject and nhibernate
I've got a SVN post-commit hook that updates a working copy when a commit
I am trying to create a very simple post-commit hook for a repository I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.