001: package org.antmod.scm;
002:
003: import java.io.File;
004:
005: /**
006: * Interface to be implemented by repository providers for access to
007: * a Source Configuration Management system such as CVS or Subversion.
008: *
009: * @author Klaas Waslander
010: */
011: public interface ScmSystem {
012:
013: public String getStandardOutput();
014:
015: public String getErrorOutput();
016:
017: /**
018: * Get the URL of the repository which this ScmSystem instance
019: * is communicating with.
020: * @return The ScmUrl of the repository which this ScmSystem instance is communicating with.
021: */
022: public ScmUrl getUrl();
023:
024: /**
025: * Set the URL this ScmSystem instance should be talking with;
026: * is only invoked from within this package.
027: * @param providerUrl The URL this ScmSystem instance should be connecting with
028: */
029: void setUrl(ScmUrl providerUrl);
030:
031: /**
032: * Add the given directory or file to this scm system.
033: * If it is not a file within an already added directory structure, the file/directory
034: * will be added to the root of this scm system.
035: * @param file The file/directory to be added
036: * @param recursive Whether to add any files under the directory recursively
037: */
038: public void doAdd(File file, boolean recursive);
039:
040: /**
041: * Checkout a module from this SCM repository into the given destination directory;
042: * the destDir contains the module contents afterwards.
043: * @param moduleName The top-level module to be checked out from the SCM repository
044: * @param destDir The destination directory for the locally checked out module contents, usually you set this to a directory with the name equal to the moduleName
045: * @param version The module version you want to checkout.
046: * @param reallyQuiet Whether console output should be suppressed
047: */
048: public void doCheckout(String moduleName, File destDir,
049: ScmVersion version, boolean reallyQuiet);
050:
051: public void doExport(String moduleName, File destDir,
052: ScmVersion version, boolean reallyQuiet);
053:
054: /**
055: * Returns true if the given directory contains a checkout
056: * of content from this ScmSystem.
057: * @param directory The directory which does or does not contain a checkout
058: * @return Whether the given directory contains a checkout
059: */
060: public boolean isCheckoutDir(File directory);
061:
062: /**
063: * Merge in changes made between current version of local module directory
064: * and given version.
065: * @param moduleDir The module directory which should receive the changes compared to the given version
066: * @param version The version containing the changes to be merged into the locally checked module directory
067: */
068: public void doMerge(File moduleDir, ScmVersion version);
069:
070: /**
071: * Update existing checkout locally to the given revision, or keep the same revision if null.
072: * @param file The directory or file to be updated
073: * @param version If null, revision of checkout is not changed
074: */
075: public void doUpdate(File file, ScmVersion version);
076:
077: /**
078: * Convenience method for doing a checkout only if needed, and otherwise
079: * updating the existing checkout.
080: * @param packageName
081: * @param revision
082: * @param destDir
083: * @param reallyQuiet
084: */
085: public void doCheckoutOrUpdate(String moduleName, File destDir,
086: ScmVersion version, boolean reallyQuiet);
087:
088: /**
089: * Commit the given file or a whole directory to CVS.
090: * @param file
091: */
092: public void doCommit(File file, String message);
093:
094: /**
095: * Get the current revision number of the given file in SCM.
096: */
097: public String getRevisionNumber(File file);
098:
099: /**
100: * Get the latest version of a locally checked out module directory.
101: * Note that if the local version is a tag, this does not work.
102: * @return null If no latest version is found
103: */
104: public ScmVersion getLatestVersion(File moduleDir);
105:
106: public ScmVersion getLocalVersion(File moduleDir);
107:
108: public ScmVersion[] getVersionsInBranch(File file, ScmVersion branch);
109:
110: public String createBranchInTrunk(ScmVersion newBranchForModule);
111:
112: public String createTagInBranch(ScmVersion existingBranch,
113: ScmVersion newTag);
114:
115: /**
116: * Check whether the given checkout directory is up-to-date
117: * when comparing it to the repository contents.
118: * @param checkoutDir The directory with locally checked out contents
119: * @return Whether the checkoutDir is up-to-date
120: */
121: public boolean isUpToDate(File checkoutDir);
122:
123: /**
124: * Get the changes between two versions of the same module.
125: * @param version1 The 'old' version to use as base
126: * @param version2 The 'new' version, which should be compared against the 'old' version
127: * @return The changes between the given versions.
128: */
129: public ScmDifference[] getDifferences(ScmVersion version1,
130: ScmVersion version2);
131: }
|