Diff merge #71

Closed
prettydiff opened this Issue Mar 30, 2015 · 37 comments

Projects

None yet
@prettydiff
Owner

I will add a merge capability to the tool. I am still thinking through how this will work while currently supporting the existing features. Any creative suggestions will be considered. A fantastic example of click to merge: http://kccode.googlecode.com/svn/trunk/source/diff/diff.html

Current thinking:

  • the diffcli option will not get merge capability
  • full merge to merge all changes from right to left or left to right
  • A click to merge capability in the output HTML diff report

Unrelated:

  • In the side-by-side view I need to add folding in the HTML diff report for consecutive inserted and deleted lines.
  • In the side-by-side view I need to add a convenient means of sliding the scrollbar to the third column
@Announcement

a pretty website...

@prettydiff
Owner

@Announcement brainstorming new presentation is a very low priority for me. You can raise the priority of this issue by recommending a proposal, though.

@prettydiff prettydiff modified the milestone: 1.11.14, V2.0.0 May 18, 2015
@ioferreira

Hi, I suggest the HTML 4 Strict to XHTML 1 Transitional (or another more appropriate) transformation including some single tags ended with and changing the !DOCTYPE line. You did an amazing job with this, and now I'm satisfied with my early confused Kompozer source-code. Thanks!

@prettydiff
Owner

Priorities and roadblocks before work on v2 can start:

  1. New markup parser
    • single unified parser for all markup related tasks
    • parser will produce parallel arrays resembling the structures used in the jspretty and csspretty libraries
    • cleaner and more modular code for both the parser and the beautifier
  2. Write a single CSV parser that conforms to the jspretty/csspretty parsing model.
  3. Build a test harness for automated unit tests of the node-local.js file (node api)
    • test each options: defaults, accepted values, and rules/constraints
    • test each output option against dummy code/dummy files
    • test each supported mode against each output option
  4. Build a test harness for prettydiff code that can run based upon the node-local test harness
    • unlike the node-local test harness this one will only be populated with simple foundational tests. This can be updated over time and hopefully with support from users.

The end result is to have a single uniform parsing model so that the diff library can operate against parsed tokens from a list instead of comparing beautified code. The goals:

  • Allow potential for >2 way diff as a possible future enhanement
  • Allow for greater precision in code analysis
  • Allow for diff merge in a very language aware means
  • Allow for superior automation potential both on the command line and in the browser
@bobtherobot

Maintain HTML br like comments, so br's don't add to the indentation.

@murrayju
murrayju commented Jun 9, 2015

I would like to see better support for using prettydiff as a tool in automated tests. Basically, I need to test that some xslt produces the correct xml output. So I'm comparing the expected result with the computed output. I would like to be able to get back a simple "yes they are equal", or "no they are different (here are some line numbers)". With the current js api, the output is a DOM object, and I have to walk the DOM to extract this information. So it is currently possible, but very ugly and brittle.

@Myp3ik
Myp3ik commented Jun 10, 2015

Hello. You could add case-insensitivity option to diff.

@prettydiff
Owner

@bobtherobot I will absolutely ensure that functionality is retained. I am almost ready to demo my new markup parser and I will let you know when it is ready.

@murrayju Have you tried using Pretty Diff with Node.js and using the diffcli? It produces output similar to git diff. If this still does not address your concerns please let me know and we can discuss how to make this better.

@Myp3ik Absolutely. I am almost ashamed I had not thought to add that before. I would likely only limit this to markup languages and string types in JavaScript.

@murrayju

@prettydiff I may be missing something, but I don't think that will do what I need. I'm running my tests in the browser (via Karma + Jasmine), so the node package won't work there. I'm also not comparing files so much as strings (generated by my code).

What I'm really asking for is a simple way to make my test pass or fail. A simple api like:

result = prettydiff({...});
// test assertion
expect(result.differences).toBe(0);

When there are differences (and my test fails), it would be helpful for debugging purposes if I could also output some simple text to the console, showing me where the problem is. I really do like the colored output of your diffcli, so it would be great if that could end up in my Karma log.

@prettydiff
Owner

@murrayju I am already reporting the number of differences at the top of the diff output (in the floating Code Report model where the HTML diff is generated). I could replicate this message somewhere more prominent so that you know how many differences there are without looking at any code output.

@murrayju

@prettydiff Right, that's what I'm using currently. I have to use jQuery to query the DOM object that prettydiff returns, to extract the numbers that I care about. While this works, it is relatively slow and very brittle. For instance, a recent prettydiff update just broke all of my tests because the output now has an additional <p> in it. I'm asking for a more simple and reliable api, that returns a pojo containing just the bits of info that I need, instead of a giant DOM object that I have no intention of rendering for these tests.

@prettydiff
Owner

@murrayju This is just a simple enhancement to the UI so I can have this done much earlier as a separate issue: #105

I will do something better though. I will create a means to beacon the data as a micro-service so that you don't have to walk the DOM with a unit test.

@filipesilva
Contributor

Two items on my wishlist would be:
-HTML preserve empty lines. This might be a stupid/incorrect idea, you tell me. EDIT: I see this already happens, nevermind!
-HTML wrap attributes. This would set each attribute in a newline, with some set/determined indentation. For example:

<button class='something' ng-show='func()' ng-click='func()'/>

would beautify into

<button class='something'
        ng-show='func()'
        ng-click='func()'/>
@Yelen719
Yelen719 commented Jul 2, 2015

Hi, Greuel. I'm using the prettyDiff. It's fantastic.But I'm wondering how to set the diff table's width to 100%? I want the result table to be full screen(not too wide or short).

@murrayju
murrayju commented Jul 2, 2015

@Yelen719 I'd imagine you could just apply some CSS

@Yelen719
Yelen719 commented Jul 2, 2015

I set the width but it didn't work. I'm a newbie... Could you please teach me how to do that? Thanks a lot!

Sent using CloudMagic [https://cloudmagic.com/k/d/mailapp?ct=pi&cv=6.1.51&pv=8.1.3]
On 周五, 7月 3, 2015 at 03:53, prettydiff/prettydiff
reply@reply.github.com
wrote:
@Yelen719 [https://github.com/Yelen719] I'd imagine you could just apply some CSS


Reply to this email directly or view it on GitHub
[https://github.com/prettydiff/prettydiff/issues/71#issuecomment-118147606] .[https://github.com/notifications/beacon/AEj2Y6Vdeicl2gUlPkDCRxZtIKHdIxlpks5oZY4rgaJpZM4D3GE6.gif]

@prettydiff
Owner

@Yelen719 If you remove the css rule white-space: pre from the selectors:

  • .beautify .data li, .diff .data li
  • .beautify .data, .diff .data

The table will automatically become 100% width of its parent aside from about 10pixels of margin on both sides.

@Yelen719
Yelen719 commented Jul 2, 2015

Thank you very much! I'll try this then.

Sent using CloudMagic [https://cloudmagic.com/k/d/mailapp?ct=pi&cv=6.1.51&pv=8.1.3]
On 周五, 7月 3, 2015 at 07:37, prettydiff/prettydiff
reply@reply.github.com
wrote:
@Yelen719 [https://github.com/Yelen719] If you remove the css rule white-space: pre from the selectors:

  • .beautify .data li, .diff .data li
  • .beautify .data, .diff .data

The table will automatically become 100% width of its parent aside from about
10pixels of margin on both sides.


Reply to this email directly or view it on GitHub
[https://github.com/prettydiff/prettydiff/issues/71#issuecomment-118193655] .[https://github.com/notifications/beacon/AEj2Y-_kZd8hGw_ifzNAiKqjXwtfQXD1ks5oZcK7gaJpZM4D3GE6.gif]

@Yelen719
Yelen719 commented Jul 3, 2015

Hi,

I tried it, but it dosen't work. The width of the table is always
determined by the length of the content. It's weird

2015-07-03 7:37 GMT+08:00 Austin Cheney notifications@github.com:

@Yelen719 https://github.com/Yelen719 If you remove the css rule white-space:
pre from the selectors:

  • .beautify .data li, .diff .data li
  • .beautify .data, .diff .data

The table will automatically become 100% width of its parent aside from
about 10pixels of margin on both sides.


Reply to this email directly or view it on GitHub
#71 (comment)
.

Best wishes.

Nan Yang

@Yelen719
Yelen719 commented Jul 3, 2015
@prettydiff
Owner

@Yelen719 No, that is what wrap does.

@tetlowgm

The ability to do an unordered XML diff. Meaning the following would be listed as equivalent:

<xml>
  <item name="item1"/>
  <item name="item2"/>
</xml>

And

<xml>
  <item name="item2"/>
  <item name="item1"/>
</xml>
@prettydiff
Owner

@tetlowgm Please visit this issue: #89

Please let me know if the feature is broken and also if it is slow or incomplete.

@tetlowgm
tetlowgm commented Aug 5, 2015

Changing the content in the new text (such that the base and new text are
different) and hitting execute shows no differences. Can you please verify?

Thanks,
Gordon

On Tue, Aug 4, 2015 at 9:40 PM, Austin Cheney notifications@github.com
wrote:

@tetlowgm https://github.com/tetlowgm Please visit this issue: #132
#132

Please let me know if the feature is broken and also if it is slow or
incomplete.


Reply to this email directly or view it on GitHub
#71 (comment)
.

@prettydiff
Owner

@tetlowgm Please try it now.

@bpromasmb

More specificity in the CSS selectors used, so as to not mess with other elements unrelated to prettydiff. An example of what can happen was pointed out in this issue

@mefynn
mefynn commented Jan 6, 2016

inline css selectors would be rad

@chenfli
chenfli commented Jan 11, 2016

Integration with shellcheck.net will be great, if not at least not automatically selects the type of code (js for bash)

Other than that, a more friendly user approach on the result panel. I run the diff, and than I cannot select the length of each column with moving the column seperator right or left as in Beyond Compare for example.

Thanks

@orbitbot
orbitbot commented Mar 9, 2016

For the PrettyDiff website, the ability to point at URLs directly in the interface without having to download and then upload source code. I recently had to compare changes in a situation where a repository had been extracted from a larger one, so being able to point at Github's raw textfiles would have been extremely handy.

@prettydiff
Owner

@orbitbot That is a defect. Please try it now.

@orbitbot
orbitbot commented Mar 9, 2016

Your link works, but I am not able to get it working with entering URLs and selecting plain text. To be clear, I entered both URLs before changing the language selection. Result:

screen shot 2016-03-09 at 18 31 13

Fundamentally, I would also say that this functionality exists in the first place is not obvious from the interface, which is why I posted the issue in the first place (came across this tool just a day or so ago).

@prettydiff
Owner

@orbitbot I just tried it and it worked for me. I am thinking you might have old code cached in your browser. Try a hard refresh

  • shift + F5 in Windows Chrome, Safari, or Opera
  • ctrl + F5 in Windows Firefox
  • shift + cmd + r in OSX

Also, try it as JavaScript. I was pleasantly surprised by the result. I cannot yet recommend JavaScript language processing for Java code, but in this case it works out perfectly.

@orbitbot
orbitbot commented Mar 9, 2016

@prettydiff Ok, that seems to work, I guess I had the previous code for the page in my cache.

@prettydiff
Owner

Closing. A breaking change to the output format is coming. For more information please see #292

@prettydiff prettydiff closed this Mar 30, 2016
@prettydiff prettydiff removed this from the V2.0.0 milestone Mar 30, 2016
@prettydiff prettydiff changed the title from Pretty Diff 2.0 - Diff merge to Diff merge Aug 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment