trackOperation('copyRepositoryRelativePath', async () => { const uri = getCurrentNuclideUri(); if (!uri) { return; } // First source control relative. const repoRelativePath = getRepositoryRelativePath(uri); if (repoRelativePath) { copyToClipboard('Copied repository relative path', repoRelativePath); return; } // Next try arcanist relative. const arcRelativePath = await getArcanistRelativePath(uri); if (arcRelativePath) { copyToClipboard('Copied arc project relative path', arcRelativePath); return; } // Lastly, project and absolute. const projectRelativePath = getAtomProjectRelativePath(uri); if (projectRelativePath) { copyToClipboard('Copied project relative path', projectRelativePath); } else { copyToClipboard( 'Path not contained in any repository.\nCopied absolute path', nuclideUri.getPath(uri), ); } });
constructor(props: Props) { super(props); this._files = []; for (const file of props.files) { const projectPath = getAtomProjectRelativePath(file); if (projectPath != null) { this._files.push(projectPath); } } this.state = { showDiffContainer: false, diffIndex: -1, }; }
trackOperation('copyProjectRelativePath', () => { const uri = getCurrentNuclideUri(); if (!uri) { return; } const projectRelativePath = getAtomProjectRelativePath(uri); if (projectRelativePath) { copyToClipboard('Copied project relative path', projectRelativePath); } else { copyToClipboard( 'Path not contained in any open project.\nCopied absolute path', nuclideUri.getPath(uri), ); } });
{Array.from(editCount).map(([path, count]) => ( <TreeItem key={path}> <PathWithFileIcon className={'nuclide-refactorizer-confirm-list-item'} path={path}> <Icon className="nuclide-refactorizer-diff-preview-icon" onClick={() => { this._diffPreview(path, response); }} icon="diff" /> <span className="nuclide-refactorizer-confirm-list-path"> {getAtomProjectRelativePath(path)} </span>{' '} ({count} {pluralize('change', count)}) </PathWithFileIcon> </TreeItem> ))}