views:

625

answers:

2

I use an ant file to build a java project in mercurial through hudson. The mailnine has a hudson job running just fine. Recently a new branch was created and pushed to the server by commnd line:


hg branch newbranch
hg commit
hg push -f


The mainine does not contain these changes and still builds fine. I have set up a new job with the same setting as mainline (in fact copied mainline job in hudson), and specified the newbranch.

However, the newbranch job builds code identical to mainline. If I commandline clone the repository and switch to the newbranch everything looks as expected. This seems to be a hudson configuration glitch unless my merqurial skills are off course.

I have also tried to set up the job from sratch with settings identical to mainline with the addition of the newbranch specification without any luck.

What am I missing? Anyone any ideas?

A: 

One issue with cloning a job is that the 'cloned' job is created as soon as you hit the clone button. While you are still configuring the cloned job, it may hit a build trigger like an SCM polling event that causes it to kick off before you have fully configured it.

I believe this was fixed in later versions of Hudson, but cannot find the changelog entry for job cloning. The same issue existed for cloning a slave configuration, and the problem was fixed in Hudson 1.319.

Michael Donohue
+4  A: 

Try putting the branch in the URL to clone like:

http://server/path/to/repo#newbranch

or

ssh://user@server//path/to/repo#newbranch

You can see the full syntax for branch-in-repo-url using hg help urls

URL Paths

Valid URLs are of the form:

  local/filesystem/path[#revision]
  file://local/filesystem/path[#revision]
  http://[user[:pass]@]host[:port]/[path][#revision]
  https://[user[:pass]@]host[:port]/[path][#revision]
  ssh://[user[:pass]@]host[:port]/[path][#revision]

Paths in the local filesystem can either point to Mercurial repositories
or to bundle files (as created by 'hg bundle' or 'hg incoming --bundle').

An optional identifier after # indicates a particular branch, tag, or
changeset to use from the remote repository. See also 'hg help revisions'.
Ry4an
Url file://local/filesystem/path[#revision] solved my problem.Thanks for the help.
Kasia
I'm thrilled to hear that. Mind accepting the answer? It'll help your rating and mine. Thanks.
Ry4an