Sublime Forum

ST3: EasyDiff

#3

Thanks for plugin, I like the use of context menu ala Beyond Compare.

My only issue is with Git. I have a rather large repository and when I right click on a view to open the context menu it takes seconds to be showed.

Didn’t look at the code but I suppose there must be a is_enabled() on menu item that call GIT.
Maybe a setting to disable this code replaced by a status bar message when there’s nothing to do could make the trick.

0 Likes

#4

No problem. You hit the nail on the head; Beyond Compare was the inspiration. It made a big difference in usability for me.

Specifically on large Git repos, or on all repos?

[quote=“bizoo”]Didn’t look at the code but I suppose there must be a is_enabled() on menu item that call GIT.
Maybe a setting to disable this code replaced by a status bar message when there’s nothing to do could make the trick.[/quote]

Yeah, is_enabled. I use to determine when to show “selection” and "view’ options, but I also use to determine if the current view is versioned control under svn, git, or mercurial (if they are enabled). With git, I have to hunt around for the “.git” folder to feed the git command before I execute the version command…I wonder if that is what takes so long, or if the version check in general takes too long because of the big repo (even though I am only polling for the single file’s status). Regardless, I can probably optionally skip the version check to speed things up.

0 Likes

#5

@bizoo I added your request

[pre=#2A2A2A] // Do not perform a version check on files
// when evaluating whether version control
// commands are enabled. May avoid slowing
// down context menu draw in large version
// controlled projects.
“skip_version_check_on_is_enabled”: false,[/pre]

This will avoid graying out version control items dynamically when showing the context menu, but hopefully speed up menu display. The commands, if run when the file is not versioned controled (vc) under the selected vc system, will display a message in the status bar. The only downside is that you won’t be guided to the appropriate menu items, but I think a slow menu would be a greater inconvenience.

0 Likes

#6

I made a slight modification in the logic to “diff last revision” in git. It just wasn’t working how I had intended. It was diffing the last commit for the repo. Now, it diffs the last revisions where the file in question was modified. This is now in line with how the other Version Control system’s commands are implemented, and how i think most would expect it to work.

0 Likes

#7

[quote=“facelessuser”]@bizoo I added your request

[pre=#2A2A2A] // Do not perform a version check on files
// when evaluating whether version control
// commands are enabled. May avoid slowing
// down context menu draw in large version
// controlled projects.
“skip_version_check_on_is_enabled”: false,[/pre]

This will avoid graying out version control items dynamically when showing the context menu, but hopefully speed up menu display. The commands, if run when the file is not versioned controled (vc) under the selected vc system, will display a message in the status bar. The only downside is that you won’t be guided to the appropriate menu items, but I think a slow menu would be a greater inconvenience.[/quote]

Works great, thanks.

[quote=“facelessuser”] bizoo wrote:My only issue is with Git. I have a rather large repository and when I right click on a view to open the context menu it takes seconds to be showed.

Specifically on large Git repos, or on all repos?[/quote]

There’s a very small delay (insignificant) for small repositories, but for a somewhat large repository (~60000 files) it takes 2-3 seconds.
startup, version: 3054 windows x64 channel: dev

Great, I was thinking about adding an external program for the diff (Beyond Compare actually). Sometimes viewing large diff in ST is not very useable.
I’ll look at it when I’ve some times.

0 Likes

#8

[quote=“bizoo”]Great, I was thinking about adding an external program for the diff (Beyond Compare actually). Sometimes viewing large diff in ST is not very useable.
I’ll look at it when I’ve some times.[/quote]

Yeah, I have considered it too. I know roughly how I would do it all behind the scenes; I should be able to even incorporate the version control diffs as well. Just not sure how I would display it in the menus yet. If I you get to it before me that is cool too :smile:.

0 Likes

#9

@bizoo, I should have some external diffing for everything but version control late tonight. I worked out what I need to do over lunch today. I code it up and commit tonight. I will get version control up and running hopefully in the next number of days. You should be able to enable/disable external diffing or internal diffing options in the settings file.

0 Likes

#10

External diff is in for left and right compare of views, selections, and clipboard. When I get time, I will get external support for version control in, but that might take me a couple of days.

Just set “show_external” to true in the settings file.
And give the absolute path to your compare tool in the “external_diff” setting.

If your compare tool uses arguments more complex than “compare_tool file1 file2”, you make have to wrap the call in a batch file or shell script depending on your system. If it is really a problem, I can make the “external diff” setting more flexible, but for the most part, I hope this isn’t a problem. On OSX, I had to wrap my call in a shell script for my diff tool, but Beyond Compare on windows just takes the files.

You can also turn off the internal sublime diff options via the “show_internal” option int he settings file if you decide you only want to use the external tool.

0 Likes

#11

Wow, was quick !
Everything works great, thanks for another useful plugin.

0 Likes

#12

No problem. I think I am on a coding kick right now…I will probably be burned out by December :smile:.

I will let you know when I finish the external version control options. Maybe I will throw it up on Package Control when I finish.

0 Likes

#13

Fixed a lot of my confusion with the version control stuff, and I enabled external version control. Hopefully all is still working and makes better sense now:

-Fix version control: “diff last revision” should be “diff with previous revision”
-Ensure svn, git, and mercurial “diff with previous revision” all behave like the name suggests (this is what I thought everything was doing the first time, but only svn behaved like this)
-When doing external diffs, copy files into temp folder to allow for more sane names for files
-Git remove “staged diff” in favor of a single diff which will show staged and unstaged against the base (this is what I wanted from the beginning)
-Add external version control options

That is it, I am done for now…unless I, or someone else, finds some bugs. I am going to give it a bit to ensure everything is stable, and if so, I think I will submit to package control.

I didn’t actually think I was going to add this much, but I think it has turned into a pretty useful plugin now.

0 Likes

#14

Any chance to support CVS? Unfortunately I’m stuck in the stone age at work with regards to version control :smile:

0 Likes

#15

I remember using CVS at my internship :smile:.

I am not sure if I will support CVS or not. I briefly thought about it. If I am able to setup a free CVS repo somewhere so I can test out client side functionality and figure out how to replicate the same features the other version control systems use for this plugin, then there is a good chance. If I am having to setup my own CVS server just so I can test out client side functionality, it just isn’t going to happen. If the interfacing with the CVS binary can’t give me what I need, it probably won’t happen either (but I this is less likely to be a sticking point).

CVS would probably be the only other system I would consider supporting.

0 Likes

#16

This should be in Package Control now.

I will be officially enabling a version control revert option as well probably tomorrow. I have tested git and mercurial, but I won’t enable it until I confirm svn revert is setup right.

That should finish up all the features I currently had planned.

0 Likes

#17

Revert is in.

0 Likes

#18

Hi,
I know this is a noob question, but how can I diff 2 tabs or files, and only select the differences?

IE: I have 2 files with a list computer names, I want to find only the systems missing from 1 file and select the missing systems so that I can put them into a new file.

Thx!!
Sully

0 Likes

#19

[quote=“virtuallynothere”]Hi,
I know this is a noob question, but how can I diff 2 tabs or files, and only select the differences?

IE: I have 2 files with a list computer names, I want to find only the systems missing from 1 file and select the missing systems so that I can put them into a new file.

Thx!!
Sully[/quote]

If I understand correctly what you are asking, you probably want to use the external option by linking easydiff to a 3rd party merge tool. The internal diff functionality is great for quickly seeing the difference. But for merging, I use EasyDiff’s external option and merge in an actual merge utility.

If you want to merge inside Sublime, then take a look at Sublimerge sublimerge.com/. I, personally, have a hard time paying for a merge tool that only works with Sublime, which is why I use EasyDiff connected to a good external merge tool when I actually need to merge.

0 Likes

#20

Easy Diff will now show the diff options in the Sidebar, Tab Context, and View Context for convenience (Sidebar will not show the selections option for obvious reasons).

Wait, but what if I don’t want to have EasyDiff show up in all of those menus?
Glad you asked! This can be controlled with the following setting, just remove the menu you don’t want to show up:

[pre=#232628] // Menus to show (view|tab|sidebar)
“menu_types”: “view”, “tab”, “sidebar”],[/pre]

Hopefully nothing broke in the process of adding this feature. I tested it well enough, but a lot of stuff changed internally.

0 Likes

#21

EasyDiff will now utilize SubNotify for messages if installed. You can disable SubNotify via the “use_sub_notify” setting. It will default back to “sublime.status_message” if SubNotify is missing or disabled.

0 Likes

#22

Howdy,

Thanks for the reply. What I’m trying to do specifically is compare 2 files, they can be text or csv,(excel would be great, but I know I can’t :smile: )

  1. Compare the files, they typically have just a single column as I paste them from excel. The values are usually something like computer names, user names, etc, most times there’s no space in between characters, but perhaps a comma, and I can remove the spaces but not the comma if it were a list of names.

  2. I am not “great” at using the visual diff option as I’m not clear on what it shows, I know the color red is if it’s in 1 file but not the other and then green if it’s in the 2nd file but not the first, but I could be wrong on the color scheme.

  3. I want to see the differences, but then export the differences/save them. What I need is to have the differences from either file, so right now I have a file with 1000 entries, and 1 file with 400. I want to find the items that exist in both files, and then come up with a list of them and then save the results, then I want to remove the items from the file with 1000 entries and save that list. I’d also like to be able to save the file with 1000 entries and “highlight” them or “notate” them so that I know that exist in the file with only 400 entries.

0 Likes