本文整理汇总了Java中org.tigris.subversion.svnclientadapter.SVNUrl类的典型用法代码示例。如果您正苦于以下问题:Java SVNUrl类的具体用法?Java SVNUrl怎么用?Java SVNUrl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SVNUrl类属于org.tigris.subversion.svnclientadapter包,在下文中一共展示了SVNUrl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectUrl
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
public void selectUrl (final SVNUrl url, final boolean force) {
Mutex.EVENT.readAccess(new Mutex.Action<Void>() {
@Override
public Void run () {
DefaultComboBoxModel dcbm = (DefaultComboBoxModel) repositoryPanel.urlComboBox.getModel();
int idx = dcbm.getIndexOf(url.toString());
if(idx > -1) {
dcbm.setSelectedItem(url.toString());
} else if(force) {
RepositoryConnection rc = new RepositoryConnection(url.toString());
dcbm.addElement(rc);
dcbm.setSelectedItem(rc);
}
return null;
}
});
}
示例2: repoinit
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
private void repoinit() throws IOException {
try {
File repoDir = getRepoDir();
File wc = getWorkDir();
if (!repoDir.exists()) {
repoDir.mkdirs();
String[] cmd = {"svnadmin", "create", repoDir.getAbsolutePath()};
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor();
}
ISVNClientAdapter client = getClient(getRepoUrl());
SVNUrl url = getRepoUrl().appendPath(getWorkDir().getName());
client.mkdir(url, "mkdir");
client.checkout(url, wc, SVNRevision.HEAD, true);
} catch (Exception ex) {
throw new IOException(ex.getMessage());
}
}
示例3: testImportFolder
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
public void testImportFolder() throws Exception {
File folder = createFolder("folder");
assertTrue(folder.exists());
ISVNClientAdapter c = getNbClient();
SVNUrl url = getTestUrl().appendPath(getName());
c.mkdir(url, "mrkvadir");
url = url.appendPath(folder.getName());
c.mkdir(url, "mrkvadir");
c.doImport(folder, url, "imprd", false);
assertTrue(folder.exists());
assertStatus(SVNStatusKind.UNVERSIONED, folder);
ISVNInfo info = getInfo(url);
assertNotNull(info);
assertEquals(url.toString(), TestUtilities.decode(info.getUrl()).toString());
assertNotifiedFiles(new File[] {}); // XXX empty also in svnCA - why?! - no output from cli
}
示例4: areCollocated
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
@Override
public boolean areCollocated(File a, File b) {
File fra = getTopmostManagedAncestor(a);
File frb = getTopmostManagedAncestor(b);
if (fra == null || !fra.equals(frb)) return false;
try {
SVNUrl ra = SvnUtils.getRepositoryRootUrl(a);
if(ra == null) {
// this might happen. there is either no svn client available or
// no repository url stored in the metadata (svn < 1.3).
// one way or another, can't do anything reasonable at this point
Subversion.LOG.log(Level.WARNING, "areCollocated returning false due to missing repository url for {0} {1}", new Object[] {a, b});
return false;
}
SVNUrl rb = SvnUtils.getRepositoryRootUrl(b);
SVNUrl rr = SvnUtils.getRepositoryRootUrl(fra);
return ra.equals(rb) && ra.equals(rr);
} catch (SVNClientException e) {
if (!WorkingCopyAttributesCache.getInstance().isSuppressed(e)) {
Subversion.LOG.log(Level.INFO, null, e);
}
Subversion.LOG.log(Level.WARNING, "areCollocated returning false due to catched exception " + a + " " + b);
// root not found
return false;
}
}
示例5: svnimport
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
public static void svnimport(File repoDir, File wc) throws SVNClientException, MalformedURLException {
ISVNClientAdapter client = getClient();
String url = TestUtilities.formatFileURL(repoDir);
SVNUrl repoUrl = new SVNUrl(url);
client.mkdir(repoUrl.appendPath(wc.getName()), "msg");
client.checkout(repoUrl.appendPath(wc.getName()), wc, SVNRevision.HEAD, true);
File[] files = wc.listFiles();
if(files != null) {
for (File file : files) {
if(!isMetadata(file)) {
client.addFile(file);
}
}
client.commit(new File[] {wc}, "commit", true);
}
Subversion.getInstance().versionedFilesChanged();
}
示例6: recountStartRevision
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
private static RevertModifications.RevisionInterval recountStartRevision(SvnClient client, SVNUrl repository, RevertModifications.RevisionInterval ret) throws SVNClientException {
SVNRevision currStartRevision = ret.startRevision;
SVNRevision currEndRevision = ret.endRevision;
if(currStartRevision.equals(SVNRevision.HEAD)) {
ISVNInfo info = client.getInfo(repository);
currStartRevision = info.getRevision();
}
long currStartRevNum = Long.parseLong(currStartRevision.toString());
long newStartRevNum = (currStartRevNum > 0) ? currStartRevNum - 1
: currStartRevNum;
return new RevertModifications.RevisionInterval(
new SVNRevision.Number(newStartRevNum),
currEndRevision);
}
示例7: revert
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
private void revert(File file, String revision) {
final Context ctx = new Context(file);
final SVNUrl url;
try {
url = SvnUtils.getRepositoryRootUrl(file);
} catch (SVNClientException ex) {
SvnClientExceptionHandler.notifyException(ex, true, true);
return;
}
final RepositoryFile repositoryFile = new RepositoryFile(url, url, SVNRevision.HEAD);
final RevertModifications revertModifications = new RevertModifications(repositoryFile, revision);
if(!revertModifications.showDialog()) {
return;
}
RequestProcessor rp = Subversion.getInstance().getRequestProcessor(url);
SvnProgressSupport support = new SvnProgressSupport() {
@Override
public void perform() {
RevertModificationsAction.performRevert(revertModifications.getRevisionInterval(), revertModifications.revertNewFiles(), !revertModifications.revertRecursively(), ctx, this);
}
};
support.start(rp, url, NbBundle.getMessage(AnnotationBar.class, "MSG_Revert_Progress")); // NOI18N
}
示例8: testContents
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
private void testContents (List<File> revisions, File file, boolean cacheFilled) throws Exception {
ISVNClientAdapter client = getFullWorkingClient();
long lastRev = client.getInfo(file).getLastChangedRevision().getNumber();
VersionsCache cache = VersionsCache.getInstance();
SVNUrl repoUrl = SvnUtils.getRepositoryRootUrl(file);
SVNUrl resourceUrl = SvnUtils.getRepositoryUrl(file);
Storage storage = StorageManager.getInstance().getStorage(repoUrl.toString());
for (File golden : revisions) {
File content;
if (!cacheFilled) {
content = storage.getContent(repoUrl.toString(), file.getName(), String.valueOf(lastRev));
assertEquals(0, content.length());
}
content = cache.getFileRevision(repoUrl, resourceUrl, String.valueOf(lastRev), file.getName());
assertFile(content, golden, null);
content = cache.getFileRevision(repoUrl, resourceUrl, String.valueOf(lastRev), String.valueOf(lastRev), file.getName());
assertFile(content, golden, null);
content = storage.getContent(resourceUrl.toString() + "@" + lastRev, file.getName(), String.valueOf(lastRev));
assertFile(content, golden, null);
--lastRev;
}
}
示例9: setupCommandline
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
public void setupCommandline () {
if(!checkCLIExecutable()) return;
factory = new ClientAdapterFactory() {
@Override
protected ISVNClientAdapter createAdapter() {
return new CommandlineClient(); //SVNClientAdapterFactory.createSVNClient(CmdLineClientAdapterFactory.COMMANDLINE_CLIENT);
}
@Override
protected SvnClientInvocationHandler getInvocationHandler(ISVNClientAdapter adapter, SvnClientDescriptor desc, SvnProgressSupport support, int handledExceptions) {
return new SvnClientInvocationHandler(adapter, desc, support, handledExceptions, ConnectionType.cli);
}
@Override
protected ISVNPromptUserPassword createCallback(SVNUrl repositoryUrl, int handledExceptions) {
return null;
}
@Override
protected ConnectionType connectionType() {
return ConnectionType.cli;
}
};
LOG.info("running on commandline");
}
示例10: RepositoryFile
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
public RepositoryFile(SVNUrl repositoryUrl, SVNUrl fileUrl, SVNRevision revision) {
this(repositoryUrl, revision);
this.fileUrl = fileUrl;
repositoryRoot = fileUrl == null;
if(!repositoryRoot) {
String[] fileUrlSegments = fileUrl.getPathSegments();
int fileSegmentsLength = fileUrlSegments.length;
int repositorySegmentsLength = repositoryUrl.getPathSegments().length;
pathSegments = new String[fileSegmentsLength - repositorySegmentsLength];
StringBuffer sb = new StringBuffer();
for (int i = repositorySegmentsLength; i < fileSegmentsLength; i++) {
pathSegments[i-repositorySegmentsLength] = fileUrlSegments[i];
sb.append(fileUrlSegments[i]);
if(i-repositorySegmentsLength < pathSegments.length-1) {
sb.append("/"); // NOI18N
}
}
path = sb.toString();
}
}
示例11: testProcessRecentFolders_NoBranchStructure
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
public void testProcessRecentFolders_NoBranchStructure () throws Exception {
JComboBox combo = new JComboBox();
JTextComponent comp = (JTextComponent) combo.getEditor().getEditorComponent();
Map<String, String> items;
// combo items should be sorted by name
// no relevant recent URL
items = CopyDialog.setupModel(combo, new RepositoryFile(new SVNUrl("file:///home"), "pathToSomeProject", SVNRevision.HEAD), recentUrlsWithBranches, false);
assertEquals(Arrays.asList(new String[] { }), new LinkedList<String>(items.keySet()));
// relevant file, but no branches
// no highlighting
items = CopyDialog.setupModel(combo, new RepositoryFile(new SVNUrl("file:///home"), "pathToSomeFolder/subfolder/folder", SVNRevision.HEAD), recentUrlsWithBranches, false);
assertModel(items, combo, Arrays.asList(new String[] {
"branches/branch1/Project/src/folder", null,
"Project/src/folder", null,
"Project2/src/folder", null,
"tags/tag1/Project/src/folder", null,
"trunk/Project/src/folder", null,
"trunk/subfolder/folder", null
}));
// least recently used is preselected
assertEquals("Project/src/folder", comp.getText());
// no branch - no selection
assertEquals(null, comp.getSelectedText());
}
示例12: checkUrlExistance
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
private ISVNInfo checkUrlExistance (SvnClient client, SVNUrl url, SVNRevision revision) throws SVNClientException {
if (url == null) {
// local file, not yet in the repository
return null;
}
if (parentMissing(url, revision)) {
return null;
}
try {
return client.getInfo(url, revision, revision);
} catch (SVNClientException ex) {
if (SvnClientExceptionHandler.isWrongURLInRevision(ex.getMessage())){
cacheParentMissing(url, revision);
return null;
} else {
throw ex;
}
}
}
示例13: startAsync
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
private void startAsync (RequestProcessor rp, SVNUrl repositoryUrl) {
support = new SvnProgressSupport() {
@Override
protected void perform () {
// filter managed roots
List<File> l = new LinkedList<File>();
for (File file : roots) {
if(SvnUtils.isManaged(file)) {
l.add(file);
}
}
if (!l.isEmpty()) {
filteredRoots = l.toArray(new File[l.size()]);
context = new Context(filteredRoots);
logger = getLogger();
shelveChanges(filteredRoots);
}
}
};
support.start(rp, repositoryUrl, NbBundle.getMessage(ShelveChangesAction.class, "LBL_ShelveChanges_Progress")); //NOI18N
}
示例14: importIntoExisting
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
/**
* Checks if the target folder already exists in the repository.
* If it does exist, user will be asked to confirm the import into the existing folder.
* @param client
* @param repositoryFileUrl
* @return true if the target does not exist or user wishes to import anyway.
*/
private boolean importIntoExisting(SvnClient client, SVNUrl repositoryFileUrl) {
try {
ISVNInfo info = client.getInfo(repositoryFileUrl);
if (info != null) {
// target folder exists, ask user for confirmation
final boolean flags[] = {true};
NotifyDescriptor nd = new NotifyDescriptor(NbBundle.getMessage(ImportStep.class, "MSG_ImportIntoExisting", SvnUtils.decodeToString(repositoryFileUrl)), //NOI18N
NbBundle.getMessage(ImportStep.class, "CTL_TargetFolderExists"), NotifyDescriptor.YES_NO_CANCEL_OPTION, //NOI18N
NotifyDescriptor.QUESTION_MESSAGE, null, NotifyDescriptor.YES_OPTION);
if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.YES_OPTION) {
flags[0] = false;
}
return flags[0];
}
} catch (SVNClientException ex) {
// ignore
}
return true;
}
示例15: getLogMessage
import org.tigris.subversion.svnclientadapter.SVNUrl; //导入依赖的package包/类
/**
* Returns log message for given revision
* @param client
* @param file
* @param revision
* @return log message
* @throws org.tigris.subversion.svnclientadapter.SVNClientException
*/
private static ISVNLogMessage getLogMessage (ISVNClientAdapter client, File file, long revision) throws SVNClientException {
SVNRevision rev = SVNRevision.HEAD;
ISVNLogMessage log = null;
try {
rev = SVNRevision.getRevision(String.valueOf(revision));
} catch (ParseException ex) {
Subversion.LOG.log(Level.WARNING, "" + revision, ex);
}
if (Subversion.LOG.isLoggable(Level.FINER)) {
Subversion.LOG.log(Level.FINER, "{0}: getting last commit message for svn hooks", CommitAction.class.getName());
}
// log has to be called directly on the file
final SVNUrl fileRepositoryUrl = SvnUtils.getRepositoryUrl(file);
ISVNLogMessage[] ls = client.getLogMessages(fileRepositoryUrl, rev, rev);
if (ls.length > 0) {
log = ls[0];
} else {
Subversion.LOG.log(Level.WARNING, "no logs available for file {0} with repo url {1}", new Object[]{file, fileRepositoryUrl});
}
return log;
}