I never got any problems with line endings and I do want fossil to be my merge 
tool.

I got the trunk source of fossil and modified it locally to work with p4merge.

p4merge requires the output file to exist.

in merge_3way function I changed it with the following lines:

      zCmd = string_subst(zGMerge, 8, azSubst);
        printf("%s\n", zCmd); fflush(stdout);
        file_touch(zOut);
        fossil_system(zCmd);
        if( file_wd_size(zOut)>0 ){
          blob_read_from_file(pOut, zOut);

file_touch is implemented as:

void file_touch(const char *zFilename){
    FILE *fh = fopen(zFilename,"w");
    fclose(fh);
}

This makes p4merge work :) I think this will also support other merge tools 
where they require the output file to exist. 

Would this or a better patch be considered for fossil?

This however does change functionality with other tools and I didn't test 
those; more specifically the size of the file being 0 was accepted before so 
you could blank the content of the file and it would accept it.

p4merge will leave the output file untouched if a merge is cancelled (leaves it 
as a 0 byte file) otherwise it contains content. So I changed the size check to 
be greater than zero.

I did try to look at the return code of fossil_system to see what p4merge was 
returning. It always seemed to return 0. 
If it had returned an error code I would have used that too in the check.


_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to