Buggy code:
private String getBranch ( EnvVars env ) { } public String getSubdir ( ) { } private FilePath workspace2Repo ( FilePath workspace ) { } @ Override @ SuppressWarnings ( "DLS_DEAD_LOCAL_STORE" ) public HgBrowser getBrowser ( ) { } public boolean isClean ( ) { } public boolean isForest ( ) { } private ArgumentListBuilder findHgExe ( AbstractBuild < ? , ? > build , TaskListener listener , boolean allowDebug ) throws IOException , InterruptedException { } ArgumentListBuilder findHgExe ( Node node , TaskListener listener , boolean allowDebug ) throws IOException , InterruptedException { } static ProcStarter launch ( Launcher launcher ) { } @ Override public SCMRevisionState calcRevisionsFromBuild ( AbstractBuild < ? , ? > build , Launcher launcher , TaskListener listener ) throws IOException , InterruptedException { } private static final String FILES_STYLE = "changeset<seq2seq4repair_space>=<seq2seq4repair_space>\'id:{node}\\nfiles:{files}\\n\'\n" + "file<seq2seq4repair_space>=<seq2seq4repair_space>'{file}:'" ; @ Override protected PollingResult compareRemoteRevisionWith ( AbstractProject < ? , ? > project , Launcher launcher , FilePath workspace , TaskListener listener , SCMRevisionState _baseline ) throws IOException , InterruptedException { } private void pull ( Launcher launcher , FilePath repository , TaskListener listener , PrintStream output , Node node , String branch ) throws IOException , InterruptedException { } static int joinWithPossibleTimeout ( ProcStarter proc , boolean useTimeout , final TaskListener listener ) throws IOException , InterruptedException { } private Change computeDegreeOfChanges ( Set < String > changedFileNames , PrintStream output ) { } private Set < String > dependentChanges ( Set < String > changedFileNames ) { } private static Pattern FILES_LINE = Pattern . compile ( "files:(.*)" ) ; private MercurialTagAction parseIncomingOutput ( ByteArrayOutputStream output , MercurialTagAction baseline , Set < String > result ) throws IOException { } public static MercurialInstallation findInstallation ( String name ) { } @ Override public boolean checkout ( AbstractBuild < ? , ? > build , Launcher launcher , FilePath workspace , final BuildListener listener , File changelogFile ) throws IOException , InterruptedException { } private boolean update ( AbstractBuild < ? , ? > build , Launcher launcher , FilePath repository , BuildListener listener , File changelogFile ) throws IOException , InterruptedException { } private boolean clone ( AbstractBuild < ? , ? > build , Launcher launcher , FilePath repository , BuildListener listener , File changelogFile ) throws IOException , InterruptedException { try { repository . deleteRecursive ( ) ; } catch ( IOException e ) { e . printStackTrace ( listener . error ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>clean<seq2seq4repair_space>the<seq2seq4repair_space>repository<seq2seq4repair_space>checkout" ) ) ; return false ; } EnvVars env = build . getEnvironment ( listener ) ; HgExe hg = new HgExe ( this , launcher , build . getBuiltOn ( ) , listener , env ) ; ArgumentListBuilder args = new ArgumentListBuilder ( ) ; MercurialSCM . PossiblyCachedRepo cachedSource = cachedSource ( build . getBuiltOn ( ) , launcher , listener , false ) ; if ( cachedSource != null ) { if ( cachedSource . isUseSharing ( ) ) { args . add ( "share" ) ; args . add ( "--noupdate" ) ; args . add ( cachedSource . getRepoLocation ( ) ) ; } else { args . add ( "clone" ) ; args . add ( "--rev" , getBranch ( env ) ) ; args . add ( "--noupdate" ) ; args . add ( cachedSource . getRepoLocation ( ) ) ; } } else { args . add ( ( forest ? "fclone" : "clone" ) ) ; args . add ( "--rev" , getBranch ( env ) ) ; args . add ( "--noupdate" ) ; args . add ( source ) ; } args . add ( repository . getRemote ( ) ) ; try { if ( ( hg . run ( args ) . join ( ) ) != 0 ) { listener . error ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>clone<seq2seq4repair_space>" + ( source ) ) ) ; return false ; } } catch ( IOException e ) { e . printStackTrace ( listener . error ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>clone<seq2seq4repair_space>" + ( source ) ) ) ) ; return false ; } <START_BUG> if ( ( cachedSource != null ) && ( cachedSource . isUseCaches ( ) ) ) { <END_BUG> FilePath hgrc = repository . child ( ".hg//hgrc" ) ; if ( hgrc . exists ( ) ) { String hgrcText = hgrc . readToString ( ) ; if ( ! ( hgrcText . contains ( cachedSource . getRepoLocation ( ) ) ) ) { listener . error ( ( ( ( ".hg//hgrc<seq2seq4repair_space>did<seq2seq4repair_space>not<seq2seq4repair_space>contain<seq2seq4repair_space>" + ( cachedSource . getRepoLocation ( ) ) ) + "<seq2seq4repair_space>as<seq2seq4repair_space>expected:\n" ) + hgrcText ) ) ; return false ; } hgrc . write ( hgrcText . replace ( cachedSource . getRepoLocation ( ) , source ) , null ) ; } hg . run ( "--config" , "extensions.relink=" , "relink" , cachedSource . getRepoLocation ( ) ) . pwd ( repository ) . join ( ) ; } ArgumentListBuilder upArgs = new ArgumentListBuilder ( ) ; upArgs . add ( ( forest ? "fupdate" : "update" ) ) ; upArgs . add ( "--rev" , getBranch ( env ) ) ; hg . run ( upArgs ) . pwd ( repository ) . join ( ) ; String tip = hg . tip ( repository ) ; if ( tip != null ) { build . addAction ( new MercurialTagAction ( tip ) ) ; } return createEmptyChangeLog ( changelogFile , listener , "changelog" ) ; } @ Override public void buildEnvVars ( AbstractBuild < ? , ? > build , Map < String , String > env ) { } @ Override public ChangeLogParser createChangeLogParser ( ) { } @ Override public MercurialSCM . DescriptorImpl getDescriptor ( ) { } public String getModules ( ) { } static boolean CACHE_LOCAL_REPOS = false ; @ CheckForNull private MercurialSCM . PossiblyCachedRepo cachedSource ( Node node , Launcher launcher , TaskListener listener , boolean fromPolling ) { } private static class PossiblyCachedRepo { private final String repoLocation ; private final boolean useCaches ;

Fix:
if ( ( ( cachedSource != null ) && ( cachedSource . isUseCaches ( ) ) ) && ( ! ( cachedSource . isUseSharing ( ) ) ) ) {