Uploaded image for project: 'Maven SCM'
  1. Maven SCM
  2. SCM-621

Mercurial provider checkout should not default to tip

    XMLWordPrintableJSON

    Details

    • Flags:
      Patch

      Description

      The checkout command for the Mercurial provider defaults to using "tip" as the revision to clone if no explicit revision is specified, for example via the scmVersion property when using the SCM plugin.

      This poses a problem for repositories with branches because tip always points to the most recent changeset in the repository regardless of branch. Thus subsequent checkouts, even moments apart, using the same options could wind up fetching completely different branches of code.

      A better option is to simply not pass a revision to Hg if no scmVersion is specified. This will cause Hg to resort to its default behavior: grab the tip-most changeset from the default branch, or "tip" itself if the default branch doesn't exist.

      One potential downside of this solution is that it will result in cloning the entire repository rather than just tip and its required ancestors. Predictable behavior is worth the cost, however, and users with large repositories can work around that limitation by explicitly making "default" their default value for scmVersion. (Or "tip" if they want to preserve the current behavior.)

        Attachments

        1. hg-checkout-no-tip.patch
          2 kB
          Kevin Calcagno

          Activity

            People

            • Assignee:
              olamy Olivier Lamy
              Reporter:
              kcalcagno Kevin Calcagno
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: