SCMFile.isRoot
Code IndexAdd Codota to your IDE (free)

Best code snippets using jenkins.scm.api.SCMFile.isRoot(Showing top 6 results out of 315)

origin: org.jenkins-ci.plugins/git

@NonNull
@Override
public Iterable<SCMFile> children() throws IOException, InterruptedException {
  if (parent().isRoot()) {
    switch (hash) {
      case "6769413a79793e242c73d7377f0006c6aea95480":
        return Collections.singleton(newChild("Jenkinsfile", false));
      case "3f0b897057d8b43d3b9ff55e3fdefbb021493470":
        return Arrays.asList(newChild("Jenkinsfile", false),
            newChild("README.md", false));
      case "a94782d8d90b56b7e0d277c04589bd2e6f70d2cc":
        return Collections.singleton(newChild("README.md", false));
      case "315fd8b5cae3363b29050f1aabfc27c985e22f7e":
        return Collections.singleton(newChild("Jenkinsfile", false));
    }
  }
  return Collections.emptySet();
}
origin: org.jenkins-ci.plugins/git

@Issue("JENKINS-42817")
@Test
public void slashyBranches() throws Exception {
  sampleRepo.init();
  sampleRepo.git("checkout", "-b", "bug/JENKINS-42817");
  sampleRepo.write("file", "modified");
  sampleRepo.git("commit", "--all", "--message=dev");
  SCMFileSystem fs = SCMFileSystem.of(r.createFreeStyleProject(), new GitSCM(GitSCM.createRepoList(sampleRepo.toString(), null), Collections.singletonList(new BranchSpec("*/bug/JENKINS-42817")), false, Collections.<SubmoduleConfig>emptyList(), null, null, Collections.<GitSCMExtension>emptyList()));
  assertThat(fs, notNullValue());
  SCMFile root = fs.getRoot();
  assertThat(root, notNullValue());
  assertTrue(root.isRoot());
  Iterable<SCMFile> children = root.children();
  Iterator<SCMFile> iterator = children.iterator();
  assertThat(iterator.hasNext(), is(true));
  SCMFile file = iterator.next();
  assertThat(iterator.hasNext(), is(false));
  assertThat(file.getName(), is("file"));
  assertThat(file.contentAsString(), is("modified"));
}
origin: org.jenkins-ci.plugins/scm-api

/**
 * Gets the file name including the path portion, such as "foo/bar/manchu.txt". Will never end in {@code /}.
 *
 * @return the pathname of this file.
 * @since 2.0
 */
@NonNull
public String getPath() {
  if (parent == null) {
    // root node
    return "";
  }
  List<String> names = new ArrayList<String>();
  SCMFile ptr = this;
  while (ptr != null && !ptr.isRoot()) {
    names.add(ptr.getName());
    ptr = ptr.parent();
  }
  Collections.reverse(names);
  return StringUtils.join(names, "/");
}
origin: org.jenkins-ci.plugins/git

@Test
public void ofSource_Smokes() throws Exception {
  sampleRepo.init();
  sampleRepo.git("checkout", "-b", "dev");
  sampleRepo.write("file", "modified");
  sampleRepo.git("commit", "--all", "--message=dev");
  SCMSource source = new GitSCMSource(null, sampleRepo.toString(), "", "*", "", true);
  SCMFileSystem fs = SCMFileSystem.of(source, new SCMHead("dev"));
  assertThat(fs, notNullValue());
  SCMFile root = fs.getRoot();
  assertThat(root, notNullValue());
  assertTrue(root.isRoot());
  // assertTrue(root.isDirectory()); // IllegalArgumentException
  // assertTrue(root.exists()); // IllegalArgumentException
  // assertFalse(root.isFile()); // IllegalArgumentException
  Iterable<SCMFile> children = root.children();
  Iterator<SCMFile> iterator = children.iterator();
  assertThat(iterator.hasNext(), is(true));
  SCMFile file = iterator.next();
  assertThat(iterator.hasNext(), is(false));
  assertThat(file.getName(), is("file"));
  assertThat(file.contentAsString(), is("modified"));
}
origin: org.jenkins-ci.plugins/git

@NonNull
@Override
public Iterable<SCMFile> children() throws IOException, InterruptedException {
  if (parent().isRoot()) {
    switch (hash) {
      case "6769413a79793e242c73d7377f0006c6aea95480":
        return Collections.singleton(newChild("Jenkinsfile", false));
      case "3f0b897057d8b43d3b9ff55e3fdefbb021493470":
        return Arrays.asList(newChild("Jenkinsfile", false),
            newChild("README.md", false));
      case "a94782d8d90b56b7e0d277c04589bd2e6f70d2cc":
        return Collections.singleton(newChild("README.md", false));
      case "315fd8b5cae3363b29050f1aabfc27c985e22f7e":
        return Collections.singleton(newChild("Jenkinsfile", false));
    }
  }
  return Collections.emptySet();
}
origin: org.jenkins-ci.plugins/scm-api

/**
 * Gets the file name including the path portion, such as "foo/bar/manchu.txt". Will never end in {@code /}.
 *
 * @return the pathname of this file.
 * @since 2.0
 */
@NonNull
public String getPath() {
  if (parent == null) {
    // root node
    return "";
  }
  List<String> names = new ArrayList<String>();
  SCMFile ptr = this;
  while (ptr != null && !ptr.isRoot()) {
    names.add(ptr.getName());
    ptr = ptr.parent();
  }
  Collections.reverse(names);
  return StringUtils.join(names, "/");
}
jenkins.scm.apiSCMFileisRoot

Javadoc

Tests if this instance is the root of the filesystem.

Popular methods of SCMFile

  • contentAsString
    A convenience method that reads the content and then turns it into a string.
  • getType
    The type of this object.
  • child
    Constructs a child/descendant SCMFile instance path relative from this object.
  • getName
    Gets the file name of this file without any path portion, such as just "foo.txt" This method is the
  • children
    If this object represents a directory, lists up all the immediate children.This method is the equiva
  • content
    Reads the content of this file.
  • contentEncoding
    Encoding of this file.This is used to interpret text files. Some SCM implementations allow users to
  • contentMimeType
    Returns the MIME type of this file.The default implementation infers this based on the file name, bu
  • getMimeType
    Looks up the servlet container's mime type mapping for the provided filename.
  • isContentText
    The opposite of #isContentBinary()
  • lastModified
    Returns the time that the SCMFile was last modified.
  • newChild
    Constructs an immediate child with the supplied type hint.
  • lastModified,
  • newChild,
  • parent,
  • type

Popular classes and methods

  • compareTo (BigDecimal)
    Compares this BigDecimal with val. Returns one of the three values 1, 0, or -1. The method behaves a
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java virtua
  • Container (java.awt)
  • BitSet (java.util)
    This implementation uses bit groups of size 32 to keep track of when bits are set to true or false.
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)