Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-4281

Better handling of Mercurial branches

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: mercurial-plugin
    • Labels:
      None
    • Environment:
      Platform: All, OS: All
    • Similar Issues:

      Description

      I have some suggestions to improve the current sequence of hg commands issued by
      the Mercurial plugin.

      Currently we have:

      hg incoming --quiet --bundle hg.bundle --template [blah...] -r $branch
      hg pull -u hg.bundle ## ( this command doesn't specify which branch the working
      copy should be brought to )

      I think this would be better:

      hg incoming --quiet --bundle hg.bundle --template [blah...] -r $branch
      hg pull hg.bundle ## ( instead of 'hg pull -u hg.bundle' )
      hg update -C -r $revision ### ( this command should bring the working copy to
      the tip of the specified branch )

      On the Java side, instead of

      if (branch!=null) args.add("-r",branch);
      else args.add("-r", "default");

      I suggest this:

      if (null == branch || branch.trim().length() == 0)

      { // Excplicitly select the default branch branch = "default"; }

      // It's safer to ALWAYS specify which branch to use
      args.add("-r", branch);

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in hudson
            User: : jglick
            Path:
            trunk/hudson/plugins/mercurial/src/main/java/hudson/plugins/mercurial/MercurialSCM.java
            trunk/hudson/plugins/mercurial/src/test/java/hudson/plugins/mercurial/MercurialSCMTest.java
            http://fisheye4.cenqua.com/changelog/hudson/?cs=21790
            Log:
            [FIXED JENKINS-4281] Some problems with named branches.
            Sometimes pulled or polled changesets from branches irrelevant to the job.
            More seriously, was impossible to switch branches without deleting workspace.
            Now always passing -r, using 'default' or the specified branch name, and updating -C.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : jglick Path: trunk/hudson/plugins/mercurial/src/main/java/hudson/plugins/mercurial/MercurialSCM.java trunk/hudson/plugins/mercurial/src/test/java/hudson/plugins/mercurial/MercurialSCMTest.java http://fisheye4.cenqua.com/changelog/hudson/?cs=21790 Log: [FIXED JENKINS-4281] Some problems with named branches. Sometimes pulled or polled changesets from branches irrelevant to the job. More seriously, was impossible to switch branches without deleting workspace. Now always passing -r, using 'default' or the specified branch name, and updating -C.
            Hide
            jglick Jesse Glick added a comment -

            I will do it a little differently than the suggested patches, but same idea.

            Show
            jglick Jesse Glick added a comment - I will do it a little differently than the suggested patches, but same idea.
            Hide
            jglick Jesse Glick added a comment -

            Basic issue.

            Show
            jglick Jesse Glick added a comment - Basic issue.
            Hide
            jglick Jesse Glick added a comment -
                • Issue 3879 has been marked as a duplicate of this issue. ***
            Show
            jglick Jesse Glick added a comment - Issue 3879 has been marked as a duplicate of this issue. ***
            Hide
            jglick Jesse Glick added a comment -
                • Issue 2502 has been marked as a duplicate of this issue. ***
            Show
            jglick Jesse Glick added a comment - Issue 2502 has been marked as a duplicate of this issue. ***

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                elifarley Elifarley
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: