-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JENKINS-5347 Fixed - Added use commit times on files #64
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,6 +267,7 @@ public class SubversionSCM extends SCM implements Serializable { | |
|
||
private boolean ignoreDirPropChanges; | ||
private boolean filterChangelog; | ||
private boolean usingCommitTimes; | ||
|
||
/** | ||
* A cache of the svn:externals (keyed by project). | ||
|
@@ -357,15 +358,16 @@ public SubversionSCM(List<ModuleLocation> locations, WorkspaceUpdater workspaceU | |
public SubversionSCM(List<ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, | ||
SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, String excludedRevprop, String excludedCommitMessages, | ||
String includedRegions, boolean ignoreDirPropChanges) { | ||
this(locations, workspaceUpdater, browser, excludedRegions, excludedUsers, excludedRevprop, excludedCommitMessages, includedRegions, ignoreDirPropChanges, false, null); | ||
this(locations, workspaceUpdater, browser, excludedRegions, excludedUsers, excludedRevprop, excludedCommitMessages, includedRegions, ignoreDirPropChanges, false, null, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're supposed to add another constructor for backwards compatibility instead of modifying an existing one. (This is why there are so many deprecated ones with fewer arguments) |
||
} | ||
|
||
@DataBoundConstructor | ||
public SubversionSCM(List<ModuleLocation> locations, WorkspaceUpdater workspaceUpdater, | ||
SubversionRepositoryBrowser browser, String excludedRegions, String excludedUsers, | ||
String excludedRevprop, String excludedCommitMessages, | ||
String includedRegions, boolean ignoreDirPropChanges, boolean filterChangelog, | ||
List<AdditionalCredentials> additionalCredentials) { | ||
List<AdditionalCredentials> additionalCredentials, boolean usingCommitTimes) { | ||
this.usingCommitTimes = usingCommitTimes; | ||
for (Iterator<ModuleLocation> itr = locations.iterator(); itr.hasNext(); ) { | ||
ModuleLocation ml = itr.next(); | ||
String remote = Util.fixEmptyAndTrim(ml.remote); | ||
|
@@ -674,6 +676,11 @@ public boolean isFilterChangelog() { | |
return filterChangelog; | ||
} | ||
|
||
@Exported | ||
public boolean isUsingCommitTimes() { | ||
return usingCommitTimes; | ||
} | ||
|
||
/** | ||
* Sets the <tt>SVN_REVISION_n</tt> and <tt>SVN_URL_n</tt> environment variables during the build. | ||
*/ | ||
|
@@ -980,6 +987,7 @@ private synchronized Map<AbstractProject, List<External>> getProjectExternalsCac | |
*/ | ||
private static class CheckOutTask extends UpdateTask implements FileCallable<List<External>> { | ||
private final UpdateTask task; | ||
private final boolean isUsingCommitTimes; | ||
|
||
public CheckOutTask(AbstractBuild<?, ?> build, SubversionSCM parent, ModuleLocation location, Date timestamp, TaskListener listener, EnvVars env) { | ||
this.authProvider = parent.createAuthenticationProvider(build.getParent(), location); | ||
|
@@ -988,6 +996,7 @@ public CheckOutTask(AbstractBuild<?, ?> build, SubversionSCM parent, ModuleLocat | |
this.location = location; | ||
this.revisions = build.getAction(RevisionParameterAction.class); | ||
this.task = parent.getWorkspaceUpdater().createTask(); | ||
this.isUsingCommitTimes = parent.isUsingCommitTimes(); | ||
} | ||
|
||
public Set<String> getUnauthenticatedRealms() { | ||
|
@@ -998,7 +1007,12 @@ public Set<String> getUnauthenticatedRealms() { | |
} | ||
|
||
public List<External> invoke(File ws, VirtualChannel channel) throws IOException { | ||
clientManager = createClientManager(authProvider); | ||
DefaultSVNOptions defaultSVNOptions = createDefaultSVNOptions(); | ||
if (isUsingCommitTimes) { | ||
defaultSVNOptions.setUseCommitTimes(isUsingCommitTimes); | ||
} | ||
|
||
clientManager = new SvnClientManager(SVNClientManager.newInstance(defaultSVNOptions, createSvnAuthenticationManager(authProvider))); | ||
manager = clientManager.getCore(); | ||
this.ws = ws; | ||
try { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div> | ||
If set Jenkins will set the file timestamps to the last commit time (of each file) when doing a checkout or an update. Otherwise Jenkins will set the current date as the timestamp of each file. | ||
<p> | ||
Normally the working copy files have timestamps that reflect the last time they were touched by any process. This is generally convenient for most build systems as they look at timestamps as a way of deciding which files need to be recompiled. | ||
In other situations, however, it's sometimes nice for the working copy files to have timestamps that reflect the last time they were changed in the repository. The svn export command always places these 'last-commit timestamps' on trees that it produces.. | ||
</p> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably mention that this refers to the 'use-commit-times' option of subversion and optionally link to subversion red-book for more detailed info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO should be called useCommitTimes as we already have 'useUpdate' (even though that's deprecated) and the subversion and SVNKit option itself is also called 'use-commit-times'