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

  • Home
  • SEARCH
  • 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 7069041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:23:51+00:00 2026-05-28T05:23:51+00:00

I am the process of writing an update script, which pulls the latest version

  • 0

I am the process of writing an update script, which pulls the latest version of a number of repositories, and rebuilds the projects. I wanted to make the build conditional, so I tried

hg pull -u && ant clean build

and the variation

hg pull; hg update && ant clean build

However, the ant build is always invoked, even when nothing has changed. I know that I can use hg incoming to check for changes before doing the pull, but this feels wasteful to me.

How can I check for new changes, without having to contact the server twice (once for hg incoming, once for hg pull)?

UPDATE: This is my build script now:

update() {
  TIP=$(hg tip --template "{node"})
  hg pull -u
  if test "$TIP" != $(hg tip --template "{node}"); then
    ant clean build
  fi
}

(cd repo1; update )
(cd repo2; update )

And for people wondering why I do a clean build every time, there are two reasons for that:

  1. The repositories depend on each other, and when the API in one of them changes, I need to do a full rebuild to find places where these API changes break code
  2. The Java compiler inlines constants, also from other class files. Now, when I change a constant in a class back to a field that can change, all other class files using that constant remain untouched by a build, and this can lead to subtle bugs that I want to avoid.
  • 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-28T05:23:52+00:00Added an answer on May 28, 2026 at 5:23 am

    You should not just run hg incoming twice since it will actually download all the changesets twice then. This because you cannot just take a sneak peek at the remote repository without running a full hg pull.

    So save the incoming changesets in a bundle and pull from that instead:

    hg incoming --bundle incoming.hg && hg pull --update incoming.hg && echo "Go!"
    

    The hg incoming command acts as a guard for the following commands: the && is short-circuiting so the first command that return a non-zero exit code will make the whole construct fail with that exit code. This means that hg pull and any following commands aren’t executed at all when hg incoming signals that there is nothing to pull.

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

Sidebar

Related Questions

Im in the process of writing a python script to act as a glue
I'm in the process of writing a basic cookie for an ecommerce site which
I am in the process of writing an application which, among other functionality, generates
I am in a process of writing a windows service which will read an
I am writing a script that processes some mmaps concurrently with multiprocessing.Process and updates
I am writing a shell script to update APC on my Ubuntu 10.04 x86_64
I have incorporated ActiveRecord into a script I am writing to process some data
I'm in the process of writing a Java 2D game. I'm using the built-in
I am in the process of writing a Bluetooth scanner that locates and identifies
I am in the process of writing a text editor. After looking at other

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.