Skip to content
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

compare modifyed workspace with Head SVN revison #60

Open
Vintic opened this issue Sep 27, 2018 · 11 comments
Open

compare modifyed workspace with Head SVN revison #60

Vintic opened this issue Sep 27, 2018 · 11 comments

Comments

@Vintic
Copy link

Vintic commented Sep 27, 2018

Hi.
After build, I need to check what changes build made comparing with last revision.
As i understood, plugin retrieve revision from workspace and then compare it with specified revision?
Or it compare workspace with specified revision, and I use it wrong?

Why I need it.
Before I deploy release to production, I need to check if was made some hot fixes directly on production without committing them in SVN.
What I think to do.
I will download that changes using RSync to Jenkins workspace and check modification with Last Changes Plugin. If all is OK I will deploy release to production.

@rmpestano
Copy link
Contributor

rmpestano commented Sep 27, 2018

Hi, the plugin needs the source code to be commited to a VCS because It uses source control commands to create the diff like svn diff or git diff. It will read current code revision from the workspace and compare with other revision.

About your use case I think you just need a delivery pipeline which has a stage where you can check the changes before going to next stage that can be the deploy to production.

@Vintic
Copy link
Author

Vintic commented Sep 27, 2018

ok, but it is possible to compare files from work space with those from head revision like SVN Diff make?
For example if, was specified head revision in Specific revision section, to use this code:
diff.setSources(SvnTarget.fromURL(new File(lastCommitInfo.getCommitFilePath())), SvnTarget.fromURL(repository.getLocation(), SVNRevision.create(currentRevision)));

@rmpestano
Copy link
Contributor

rmpestano commented Sep 27, 2018

As far as I know (I may be wrong) the diff is done between two revisions and you don't have a revision until you commit to the repository.

Anyway even if possible I don't plan to add support for such usecase unless the fix is transparent to enduser (e.g no UI change) and minor change is required to the plugin codebase.

@Vintic
Copy link
Author

Vintic commented Sep 27, 2018

Being in checkout directory and writing in command line " svn diff --revision 26347 "
it display local changes that was made.

@Vintic
Copy link
Author

Vintic commented Sep 27, 2018

Here is implementation with SVNDiffClient:
https://wiki.svnkit.com/Diffing%20a%20working%20copy%20against%20a%20repository

@rmpestano
Copy link
Contributor

rmpestano commented Sep 27, 2018

I see, I still think it is a very "strange" use case to support.

I'd suggest you to fork this plugin and add the feature you need. You can see build and run instructions here.

@Vintic
Copy link
Author

Vintic commented Sep 28, 2018

Thank you,

I found a solution and made some changes in code:
Now when I write in "Specific revision" word: "Base".

Is executing something like:
lastChanges = svnLastChanges.changesOf(repository, SVNRevision.WORKING, SVNRevision.BASE);

and some minor changes was added to work properly.

@rmpestano
Copy link
Contributor

Nice, glad you made it working!

Lets keep this issue opened and if more users ask for It we can think in incorporate into master.

@Vintic
Copy link
Author

Vintic commented Oct 1, 2018

Hi, again)

How I can add file description ( like: modified date ) in the header of file diff div.

Usage:
I want to highlight files that was modified on production from last build, by checking file modified date and last success build date.

@rmpestano
Copy link
Contributor

rmpestano commented Oct 1, 2018

Hi,

the list of changed files is generated by diff2html, you may ask there if there's a way to add info to the list.

You probably know but the UI code of this plugin resides in this jelly file: https://github.com/jenkinsci/last-changes-plugin/blob/50814d8d722c89a159b440ab60cdd145696745c7/src/main/resources/com/github/jenkins/lastchanges/LastChangesBuildAction/index.jelly

@SunBlack
Copy link

I agree with @Vintic that it would be nice to be able to compare the working directory with the last commit. This way it would be possible to show changes by clang-format or other code formatting tools for example (and in best case the tool can also set the build failure state if there is a change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants