Skip to content

Commit

Permalink
[FIXED JENKINS-13734] Remove sticky date tag properly
Browse files Browse the repository at this point in the history
Prevent CVS thinking we're on an old date and therefore aren't up-to-date
  • Loading branch information
mc1arke committed Jun 8, 2012
1 parent 26590eb commit b065387
Showing 1 changed file with 36 additions and 12 deletions.
48 changes: 36 additions & 12 deletions src/main/java/hudson/scm/CVSSCM.java
Expand Up @@ -844,22 +844,46 @@ public boolean checkout(final AbstractBuild<?, ?> build, final Launcher launcher
build.getActions().add(new CvsTagAction(build, this));

// remove sticky date tags
workspace.act(new FileCallable<Void>() {
for (final CvsRepository repository : getRepositories()) {
for (final CvsRepositoryItem repositoryItem : repository.getRepositoryItems()) {
for (final CvsModule module : repositoryItem.getModules()) {
workspace.child(module.getCheckoutName()).act(new FileCallable<Void>() {
@Override
public Void invoke(File module, VirtualChannel virtualChannel) throws IOException, InterruptedException {
final AdminHandler adminHandler = new StandardAdminHandler();

private static final long serialVersionUID = -6867861913158282961L;
cleanup(module, adminHandler);

@Override
public Void invoke(final File f, final VirtualChannel channel) throws IOException {
AdminHandler adminHandler = new StandardAdminHandler();
for (File file : adminHandler.getAllFiles(f)) {
Entry entry = adminHandler.getEntry(file);
entry.setDate(null);
adminHandler.setEntry(file, entry);
}
return null;
}

return null;
private void cleanup(File directory, AdminHandler adminHandler) throws IOException {
for (File file : adminHandler.getAllFiles(directory)) {
Entry entry = adminHandler.getEntry(file);
entry.setDate(null);
adminHandler.setEntry(file, entry);
}

// we need to remove CVS/Tag as it contains a sticky reference for HEAD modules
if (repositoryItem.getLocation().getLocationType() == CvsRepositoryLocationType.HEAD) {
final File tagFile = new File(directory, "CVS/Tag");

if (tagFile.exists()) {
tagFile.delete();
}
}

for (File innerFile : directory.listFiles()) {
if (innerFile.isDirectory() && !innerFile.getName().equals("CVS")) {
cleanup(innerFile, adminHandler);
}
}
}
});
}
}
});
}


return true;
}
Expand Down

0 comments on commit b065387

Please sign in to comment.