Beyond compare as merge tool on P4 Eclipse plugin - merge

I'm trying to configure the P4Eclipse plugin (2014.1.965331) to use Beyond Compare as external Merge tool.
I have configured the Bcomp.exe as Perforce Merge in Perferences -> Team -> Perforce ->External Tools. so right now when resolve is requested it's opens the Beyond compare, but without the content of the files.
I know there is a list of arguments that needed to be passed (in P4V it's passed in the argument line as %1 %2 %b %r), as documented here : Using Beyond Compare with Version Control Systems
But no luck with the arguments, the trick for adding the arguments is to create a .bat file that calles to Bcomp.exe with additional arguments and set external merge toll to run the .bat file.
Is there any chance to configure it to work fine with beyond compare. (for now only 2 way merge is requested)

The list of arguments is fixed in the P4Eclipse code.
You're right, you're going to have to write a .bat/.cmd to adjust the parameter list.
P4Eclipse code is in our workshop.
The class that runs the command:
https://swarm.workshop.perforce.com/projects/perforce-software-p4eclipse/files/2014-1/src/3.7/plugins/com.perforce.team.ui/src/com/perforce/team/ui/p4merge/MergeRunner.java
Note method getBuilder() that makes the argument list. The constructor too. That's what we've got for documentation right now.
What it passes to the constructor depends on what you're doing - like merge vs diff.
For example, see the "new MergeRunner(...)" in
https://swarm.workshop.perforce.com/projects/perforce-software-p4eclipse/files/2014-1/src/3.7/plugins/com.perforce.team.ui/src/com/perforce/team/ui/p4merge/P4MergeResolveAction.java

Related

Step my script not its imports - functionality?

It is actually a credit to the strength of PyDev/ Eclipse that the debugger also steps through the corresponding parts of the imported numpy/pandas, at the places their functionalities are used by my script e.g. df = pandas.dataframe({...
But if I am confident that the imports work OK: Is there a way for the debugger to step only through my own 10 lines of script and not its imports? It would save a lot of inspection time.
(Eclipse for C/C++ on Windows 10 64bit)
Thank you!
There's actually such functionality available in the debugger, but it currently doesn't have an UI (still didn't have time to implement it).
Still, you can set an environment variable to use it.
I.e.: add an environment variable named PYDEVD_FILTERS (you can add it in the interpreter configuration or by editing your launch) and set it to be a list of paths which match the directories you want to ignore separated by ; (fnmatch style) -- those matches will be skipped by the debugger.
See: https://github.com/fabioz/PyDev.Debugger/blob/master/_pydevd_bundle/pydevd_utils.py#L191 as a reference for this (i.e.: pydevd_utils.is_ignored_by_filter).

How can I script Perforce to merge non-conflict code?

Background
We have scripts that generate a large portion of our code.
We don't want to use scripts for generating all of the code.
Typically, we would keep this code separate, but we are considering scripts that generate portions of the code that will also be modified by programmers, e.g. function / class definitions, i.e. first we parse a header file that specifies the function parameters and enumerations, then we generate all the empty functions.
We can ensure that programmers will never modify code that is generated by the scripts.
We need a method to automate the merging of these files after being edited by the scripts; e.g. our input definition file is updated (externally) and we need to modify the function parameters.
Method
Two scripts: "Previous" and "Current" (identical)
Modify "Current" and regenerate code; "P4 edit" into changelist
Merge code:
2.a. Base = Generated code from "Previous"; in temporary folder
2.b. Left = Generated code from "Current"
2.c. Right = Existing code; current version checked into P4
Save "Current" as "Previous"
Problem
I can't figure out how to automate step #2. We have over 100 files we'd like to auto generate so manually merging is not an option.
Using "p4merge.exe" requires GUI interaction; as far as I can tell.
I looked at "p4 merge", "p4 integrate", "p4 resolve" and "p4 sync", but I couldn't figure out how to invoke the correct behavior.
Any help would be appreciated, including alternative methods.
Cheers.
Per jamesdlin's comments, I figured out how to accomplish what I wanted.
New Method
One script "Current".
Add generated files to P4 (always version #1)
"p4 sync [file]#1" then "p4 edit [file]"
Modify "Current" and regenerate code
Run "p4 sync" again (without revisions) to mark the files for resolve.
Run "p4 resolve -am" to auto resolve the files.
This should work even after multiple iterations of the script. As long as I can avoid conflicts then this should be completely automated.
Rather than combining your machine-generated code in the same source files as the human-authored code, what about changing your code generation strategy so that your tool generates the super-class code, and humans can individually author sub-classes of the machine-generated classes which override the necessary methods to provide the needed behavior.
That's how I've typically done this sort of development in the past.

Diff merge : view difference between two folders and ignore file version number

I need some help. I have to view difference between two folders, but I need to ignore the file version number (project version number) which is in the header of the file. Like that:
#version Release: $Revision: 9939 $
And do you know the best diff merge software for doing that in Mac OSX and the most beautiful. I know diff merge and Kaleidoscope. I love Kaleidoscope but, it cannot make some difference between two folders.
Many thanks before.
Try going into DiffMerge → Preferences → File Windows → Rulesets. You can modify the existing ruleset for your file type (or add a new one if no ruleset exists already).
Edit the ruleset you're interested in, and go to Lines to Omit. In there you can add a regex to match that line #version.
What I'm having trouble with is getting the folder diff to honor this. I find that files with no diffs according to my rules still end up in the folder diff as a non-match, but when I open the file diff window it says Files are identical or equivalent under the current RuleSet. Not sure if this is a bug or I still have something configured wrong. If I go into Folder Windows → Equivalence Mode and dig into the help there, I think I have all the folder diff properties set correctly to honor my rulesets, but still no luck.
It's a pity you need MacOS. For Win32 there is WinMerge readily configurable via Tools/Filters/Linefilters where you simply enter a regular expression to be ignored.
http://manual.winmerge.org/Filters.html
For example, you might use line filters to ignore comments or certain type of generated code, like version control system timestamps
WinMerge 3 will be Qt based hence MacOS positive too, but current 2.x is not yet.

Validate against an Eclipse formatting profile from command line

I'm looking for a way to verify Java code against an Eclipse code formatting profile from the command line. The goal is to create a Mercurial hook which rejects any commit that doesn't match the profile. Is there a way to do this?
I'm aware of the possibility to call Eclipse's formatter from the command line. What I'm looking for is something which just validates (yes/no). I guess I could use the formatter and then compare the two, but it seems like a clumsy approach.
Background: The reason we want to try this is because we currently get many unnecessary merge conflicts because of formatting differences. We have an environment where multiple IDE:s are used, although only one is officially supported. We want to enforce the official profile, and everyone can continue using the tools they prefer as long as they set it up to format the code correctly.
In brief, follow those steps:
Duplicate the original Java file in a temporary place ;
Format the temporary duplicate using the Eclipse Java code formatter ;
Check whether the files are identical or not.
Tricks to help you out:
To call the Eclipse Java code formatter from command line, see Formatting your code using the Eclipse code formatter.
To know whether files are identical, using the diff utility: diff --text --quiet >/dev/null, the error code will tell you what you're seeking for.

Matlab: how to find functions on path that use a given function

It sometimes happens that I need to change the behavior of a function. Is there an easy way to find functions (on the matlab path) that use that function?
The way I do this is to look for files that contain the name of the function I'm interested in. Thus, I don't only see who calls my function, but also what signature they use.
In the editor: Edit->Find Files
Start with help deprpt.
EDIT: when I run a dependency report there are 3 checkboxes at the top of the report window. One of these, by default unchecked, is called 'Show parent functions (current folder only)'. That is probably the beginning of what you want but it only works in a single folder.
If you want more than that, I suggest that you try edit deprpt.m.
I would use a tool like grep. I posted a tool called mgrep on the file exchange a few years ago. It can search through entire directories of m-files for any given string, and it searched recursively down into sub-directories. So to find functions in my directories that call fminsearch, I would merely execute this at the command line.
mgrep('fminsearch','.','show','off')
Searching directory(ies)...
/Users/woodchips/Desktop/My_FEX/cylinderfit.m
/Users/woodchips/Desktop/My_FEX/fminspleas.m
/Users/woodchips/Desktop/My_FEX/fminspleas2.m
/Users/woodchips/Desktop/My_FEX/fminspleas3.m
/Users/woodchips/Desktop/My_FEX/fminspleasnnls.m
/Users/woodchips/Desktop/My_FEX/BoundedFSOLVE/fsolvebnd.m
/Users/woodchips/Desktop/My_FEX/FMINSEARCHBND/fminsearchbnd.m
...
you mean like looking for dependencies? that would be tools -> show dependency report