if (expandedLocation.getRevision(null) != null) { int idx = expandedRemote.lastIndexOf('@'); if (idx >= 0) {
/** * Test parsing of @revision information from the tail of the URL */ @Test public void moduleLocationRevisions() throws Exception { SubversionSCM.ModuleLocation m = new SubversionSCM.ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant@13000", null); SVNRevision r = m.getRevision(null); assertTrue(r.isValid()); assertEquals(13000, r.getNumber()); assertEquals("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant", m.getURL()); m = new SubversionSCM.ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant@HEAD", null); r = m.getRevision(null); assertTrue(r.isValid()); assertSame(r, SVNRevision.HEAD); assertEquals("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant", m.getURL()); m = new SubversionSCM.ModuleLocation("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant@FAKE", null); r = m.getRevision(null); assertFalse(r.isValid()); assertEquals("https://svn.jenkins-ci.org/trunk/hudson/test-projects/trivial-ant@FAKE", m.getURL()); }
/** * Determines the revision to check out for the given location. */ protected SVNRevision getRevision(ModuleLocation l) { // for the SVN revision, we will use the first off: // - a @NNN suffix of the SVN url // - a value found in a RevisionParameterAction // - the revision corresponding to the build timestamp SVNRevision r = null; if (revisions != null) { r = revisions.getRevision(l.getURL()); } if (r == null) { r = SVNRevision.create(timestamp); } r = l.getRevision(r); return r; }