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 219185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:49:16+00:00 2026-05-11T18:49:16+00:00

I am a mercurial user on windows and I am trying to write a

  • 0

I am a mercurial user on windows and I am trying to write a batch file to check for incoming changes to a number of repositories stored in a common folder (i.e. there could be 10 or so small mercurial repos under a main folder). I have the following batch file that successfully iterates through the multiple repositories and runs hg incoming. However I can’t seem to get it to execute hg -pull -u when a repository is found that has remote changes.

   FOR /D /r %%G in (".hg*") DO (
    @echo Processing: %%G
    cd /d %%G\.. 
    hg incoming
    IF NOT ERRORLEVEL 0 (
        echo Pulling changes from the server
        hg pull -u
    )
    cd..
    )

I am pretty sure the problem lies with the If statement. hg incoming doesn’t seem to have a return value that can be interpreted by the ERRORLEVEL. Is this the right approach or should I be using python instead?

  • 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-05-11T18:49:16+00:00Added an answer on May 11, 2026 at 6:49 pm

    The exit code for hg incoming and hg outgoing is 1 if there were no incoming/outgoing changesets and 0 otherwise and this means that your test is backwards. (The exit codes have been documented since this question was asked and can now be found in hg help incoming and hg help outgoing.)

    Also, doing both hg incoming and hg pull does the job twice: you should simply use hg pull. The help for hg incoming says:

    For remote repository, using --bundle avoids downloading the
    changesets twice if the incoming is followed by a pull.

    So you’re actually downloading all changesets twice, using twice the bandwidth.

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

Sidebar

Related Questions

I'm a Git user trying to use Mercurial. Here's what happened: I did a
I'm in the middle of trying to get mercurial working on a windows build
mercurial-server manages user database under keys folder. Users and groups are represented by files
Possible Duplicate: Mercurial: How to ignore changes to a tracked file I work on
Two unrelated Mercurial repositories are created: user@SERVER ~/mercurialtest $ cd jointest/ user@SERVER ~/mercurialtest/jointest $
I'm trying to modify this Mercurial extension to prompt the user to add a
I am trying to get mercurial to ignore hidden files for a specific user.
I'm sharing a Mercurial repo with a user dias , whom I would trust
Mercurial supports push-style cloning of repositories to remote hosts, however newly cloned repositories don't
I have a local mercurial repository with some site-specific changes in it. What 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.