Maven SCM
  1. Maven SCM
  2. SCM-508

Wrong scm url validation for mercurial provider

    Details

    • Complexity:
      Intermediate
    • Number of attachments :
      1

      Description

      According to documentation (http://maven.apache.org/scm/mercurial.html) scm url can be of this form:
      scm:hg:file://C:/dev/project/v3
      but it doesn't work due to a bug in https://svn.apache.org/repos/asf/maven/scm/tags/maven-scm-1.2/maven-scm-providers/maven-scm-provider-hg/src/main/java/org/apache/maven/scm/provider/hg/HgScmProvider.java
      private HgUrlParserResult parseScmUrl( String scmSpecificUrl )
      line 104: if ( !url.startsWith( "file:///" ) && !url.startsWith( "file://localhost/" ) )

      The fix might be the following (like in svn provider)
      line 104: if ( !url.startsWith( "file://" ) && !url.startsWith( "file://localhost/" ) )

        Activity

        Hide
        Andreas Ebbert-Karroum added a comment -

        The webpage for the hg scm provider shows example URLs

        http://maven.apache.org/scm/mercurial.html

        scm:hg:http://host/v3
        scm:hg:file://C:/dev/project/v3 (windows drive)
        scm:hg:file:///home/smorgrav/dev/project/v3 (linux drive)
        scm:hg:/home/smorgrav/dev/project/v3 (local directory)

        So on Windows its two slashes, on linux its three. It'd be nice if the plugin worked on linux AND windows.

        Show
        Andreas Ebbert-Karroum added a comment - The webpage for the hg scm provider shows example URLs http://maven.apache.org/scm/mercurial.html scm:hg: http://host/v3 scm:hg: file://C:/dev/project/v3 (windows drive) scm:hg: file:///home/smorgrav/dev/project/v3 (linux drive) scm:hg:/home/smorgrav/dev/project/v3 (local directory) So on Windows its two slashes, on linux its three. It'd be nice if the plugin worked on linux AND windows.
        Hide
        Laurent Perez added a comment -

        Please find an attached path with the file:// fix, this will allow Windows users to release on local repositories like :

            <scm>
                <connection>scm:hg:file://c/devhome/projects/maven/repo/</connection>
                <developerConnection>scm:hg:file://c/devhome/projects/maven/repo/</developerConnection>
            </scm>
        
        Show
        Laurent Perez added a comment - Please find an attached path with the file:// fix, this will allow Windows users to release on local repositories like : <scm> <connection>scm:hg:file: //c/devhome/projects/maven/repo/</connection> <developerConnection>scm:hg:file: //c/devhome/projects/maven/repo/</developerConnection> </scm>
        Hide
        Dennis Lundberg added a comment -

        It is the documentation that is wrong. The correct URL for a local Windows path should be:
        scm:hg:file:///C:/dev/project/v3

        Note the 3 slashes after "file:" instead of 2.

        Show
        Dennis Lundberg added a comment - It is the documentation that is wrong. The correct URL for a local Windows path should be: scm:hg: file:///C:/dev/project/v3 Note the 3 slashes after "file:" instead of 2.
        Hide
        Laurent Perez added a comment -

        Dennis, you are probably right, but http://maven.apache.org/scm/bazaar.html and http://maven.apache.org/scm/subversion.html are referencing double slashes and their code is using double slashes too, I don't know why, perhaps it was assumed that the file:// protocol does not need a third slash on windows because there is no "root directory", drive letters start without a mount point.

        Anyway, feel free to mark this one as wontfix or invalid if needed, I guess that in practice, most people on windows wanting to use a local repo would probably use hg serve and hg clone their http://localhost:8000 repository instead of using a local file: repository.

        Show
        Laurent Perez added a comment - Dennis, you are probably right, but http://maven.apache.org/scm/bazaar.html and http://maven.apache.org/scm/subversion.html are referencing double slashes and their code is using double slashes too, I don't know why, perhaps it was assumed that the file:// protocol does not need a third slash on windows because there is no "root directory", drive letters start without a mount point. Anyway, feel free to mark this one as wontfix or invalid if needed, I guess that in practice, most people on windows wanting to use a local repo would probably use hg serve and hg clone their http://localhost:8000 repository instead of using a local file: repository.
        Hide
        Lóránt Pintér added a comment -

        Using http://localhost:8000 is not a solution when you want to use the release pluign's localCheckout feature. It produces this error on Windows:

        C:\Workspaces\Eclipse\Test-TOPclipse-3.7\tis-parent>mvn release:perform -DlocalCheckout=true
        [INFO] Scanning for projects...
        [INFO]
        [INFO] ------------------------------------------------------------------------
        [INFO] Building TIS Parent 3.1-SNAPSHOT
        [INFO] ------------------------------------------------------------------------
        [INFO]
        [INFO] --- maven-release-plugin:2.2.1:perform (default-cli) @ tis-parent ---
        [INFO] Checking out the project to perform the release ...
        [INFO] Performing a LOCAL checkout from scm:hg:file://C:\Workspaces\Eclipse\Test-TOPclipse-3.7\tis-parent
        [ERROR] The scm url is invalid.
        [INFO] ------------------------------------------------------------------------
        [INFO] BUILD FAILURE
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 2.325s
        [INFO] Finished at: Tue Aug 02 14:34:57 CEST 2011
        [INFO] Final Memory: 7M/105M
        [INFO] ------------------------------------------------------------------------
        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.2.1:perform (default-cli) on project tis-parent:
        The scm url is invalid.
        [ERROR] - An hg 'file' url must be on the form 'file:///' or 'file://localhost/'.
        [ERROR] -> [Help 1]
        [ERROR]
        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
        [ERROR]
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
        
        Show
        Lóránt Pintér added a comment - Using http://localhost:8000 is not a solution when you want to use the release pluign's localCheckout feature. It produces this error on Windows: C:\Workspaces\Eclipse\Test-TOPclipse-3.7\tis-parent>mvn release:perform -DlocalCheckout= true [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building TIS Parent 3.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-release-plugin:2.2.1:perform ( default -cli) @ tis-parent --- [INFO] Checking out the project to perform the release ... [INFO] Performing a LOCAL checkout from scm:hg:file: //C:\Workspaces\Eclipse\Test-TOPclipse-3.7\tis-parent [ERROR] The scm url is invalid. [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.325s [INFO] Finished at: Tue Aug 02 14:34:57 CEST 2011 [INFO] Final Memory: 7M/105M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.2.1:perform ( default -cli) on project tis-parent: The scm url is invalid. [ERROR] - An hg 'file' url must be on the form 'file: ///' or 'file://localhost/'. [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch . [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http: //cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
        Hide
        Benoit Guerin added a comment -

        any update on this ?

        It is (for me) a blocker bug :
        we are using DVCS, so we except not to clone from Internet when releasing. And from now, with this bug, the only way to release from Windows PC is to let localCheckout to false in the maven-release-plugin configuration ...

        Show
        Benoit Guerin added a comment - any update on this ? It is (for me) a blocker bug : we are using DVCS, so we except not to clone from Internet when releasing. And from now, with this bug, the only way to release from Windows PC is to let localCheckout to false in the maven-release-plugin configuration ...
        Hide
        Devin Reid added a comment -

        Just got bit by this one. localCheckout=true is not working on Windows. Same error as commented above.

        Show
        Devin Reid added a comment - Just got bit by this one. localCheckout=true is not working on Windows. Same error as commented above.

          People

          • Assignee:
            Unassigned
            Reporter:
            Alexander Nemish
          • Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated: