Note that there are some explanatory texts on larger screens.

plurals
  1. POResolve path of IVersionableHandle in RTC
    text
    copied!<p>How to get path of file which isn't in newest version but is a part of previous changelist in <code>RTC scm</code>.</p> <p>All I could achieve so far is this:</p> <pre class="lang-java prettyprint-override"><code>IFileItemHandle fileItemHandle = (IFileItemHandle) IFileItem.ITEM_TYPE.createItemHandle(change.afterState().getItemId(), change.afterState().getStateId()); file = versionableManager.fetchCompleteState(fileItemHandle, monitor); if (file instanceof IFolder) { IFolder folder = (IFolder) file; relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor); fileName = folder.getName(); } else { relativePath = getFilePath(file, workspaceConnection.configuration(changeSet.getComponent()), monitor); fileName = ((FileItem) file).getName(); } </code></pre> <p>Where <strong>getFilePath</strong> is:</p> <pre class="lang-java prettyprint-override"><code>private String getFilePath(IVersionableHandle folder, IConfiguration config, IProgressMonitor monitor, Boolean searchInHistory) throws TeamRepositoryException { List lst = new ArrayList&lt;IVersionableHandle&gt;(), ancestors; lst.add(folder); if (searchInHistory) { ancestors = config.determineAncestorsInHistory(lst, monitor); } else { ancestors = config.locateAncestors(lst, monitor); } return getFullPath(ancestors); } private String getFullPath(List ancestor) throws TeamRepositoryException { String directoryPath = ""; for (Object ancestorObj : ancestor) { IAncestorReport ancestorImpl = (IAncestorReport) ancestorObj; for (Object nameItemPairObj : ancestorImpl.getNameItemPairs()) { INameItemPair nameItemPair = (INameItemPair) nameItemPairObj; String pathName = nameItemPair.getName(); if (pathName != null &amp;&amp; !pathName.equals("")) { directoryPath = directoryPath + "\\" + pathName; } } } return directoryPath; } </code></pre> <p>Unfortunately it doesn't work perfectly. If filename is changed in following changelists like on this example:</p> <pre><code>Changelist 1: add file: src/newFile.java Changelist 2: modify file: src/newFile.java Changelist 3: rename file: src/newFile.java -&gt; src/newFile_rename.java </code></pre> <p>The relative path resolved in first changelist would be: </p> <pre><code>src/newFile_rename.java </code></pre> <p>instead of</p> <pre><code>src/newFile.java </code></pre> <p>How to make it works good?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload