P3D3::Ability to annotate base and compare revisions in differences view

Issue #200 resolved
Eugene Golushkov
created an issue

Hello again, Jason!

In my current project we are in the stage, where big amount of changes in one branch must be transferred to the other branch, that itself has huge amount of changes. And due to the size of the project it hard to say where is the preferred version only from information in differences view.

Therefore ability to annotate different revisions of the same file is highly desirable, so that at least time and commit revision for each line can be checked.

Here is the patch, that do this.

Comments (18)

  1. Jason Harris repo owner
    • changed status to open

    Hey Eugene!

    First thanks for the patch! I like it. I will add it. However could I get you to change it a bit so we keep:

    - (void) primaryActionAnnotateSelectedFiles:(NSArray*)absolutePaths withRevision:(NSNumber*)version andOptions:(NSArray*)options
    

    As it is but instead create a new routine

    Which just does

    - (NSArray*) annotationOptionsFromDefaults
    {
    	NSMutableArray* options = [[NSMutableArray alloc] init];
    	if (DefaultAnnotationOptionChangesetFromDefaults())		[options addObject:@"--changeset"];
    	if (DefaultAnnotationOptionDateFromDefaults())			[options addObject:@"--date"];
    	if (DefaultAnnotationOptionFollowFromDefaults())		[options addObject:@"--follow"];
    	if (DefaultAnnotationOptionLineNumberFromDefaults())	[options addObject:@"--line-number"];
    	if (DefaultAnnotationOptionNumberFromDefaults())		[options addObject:@"--number"];
    	if (DefaultAnnotationOptionTextFromDefaults())			[options addObject:@"--text"];
    	if (DefaultAnnotationOptionUserFromDefaults())			[options addObject:@"--user"];
    	return options;
    }
    

    at the end of section "Preference Handling" in AppController.m and then use that throughout your patch. This will be more compatible with the way I will do things in the future...! Just send me the new complete unified patch!

    Thanks!! Jas

  2. Eugene Golushkov reporter

    Yes, Jason, I can do that with options, but here is one issue. Absolute paths were filtered by FSBrowser instance, and for differences view it must be another FSBrowser instance, other than the one embedded into the document. So there are two possibility: pass it as parameter or pass already filtered paths. I choose the second way, and therefore changed method name to more "internally" sound, "annotateFiles: withRevision:" that don`t do filtering instead of "primaryActionAnnotateSelectedFiles: ..." methods family that do it. If it`s OK for you, than here is corrected patch.

  3. Jason Harris repo owner

    Ahhh... Good point... Well now that the annotations are moving towards being used at different stages of history... We should probably just keep:

    - (void) primaryActionAnnotateSelectedFiles:(NSArray*)absolutePaths withRevision:(NSNumber*)version andOptions:(NSArray*)options
    {
    	NSString* rootPath = [self absolutePathOfRepositoryRoot];
    	NSArray* filteredPaths = [self filterPaths:absolutePaths byBitfield:eHGStatusInRepository];
    ...
    

    But change it the filtering as follows:

    - (void) primaryActionAnnotateSelectedFiles:(NSArray*)absolutePaths withRevision:(NSNumber*)version andOptions:(NSArray*)options
    {
    	NSString* rootPath = [self absolutePathOfRepositoryRoot];
    	NSArray* filteredPaths = [self filterPaths:absolutePaths byManifestOfRevision:version];
    ...
    

    Where we (hopefully you :) ) will write the MacHgDocument method:

    - (NSArray*) filterPaths:(NSArray*)absolutePaths byManifestOfRevision:(NSNumber*)version
    {
       ... Get the manifest of version version ...
       ... Filter the paths by the manifest at that time ...
       ... return the filtered paths ...
    }
    

    Of course once the annotation view comes along this will get revised but this would take it in the correct direction...

    Thanks again for doing this!! :)

    Cheers, Jas

  4. Eugene Golushkov reporter

    Sorry, have no time for this. My minor problem is already solved by custom version of MacHG, and my huge project is waiting for me.

    With best regards, Eugene Golushkov

  5. Jason Harris repo owner

    Ok, Eugene. I understand... Sorry to ask for more tweaks. I know it can be annoying when submitting patches to a project that the people come back and ask you to tweak this then that, then something else... It happens to me when I submit patches as well to other projects :)

    In any case does anyone else want to pick this change up and write the procedure:

    - (NSArray*) filterPaths:(NSArray*)absolutePaths byManifestOfRevision:(NSNumber*)version
    

    Thanks! Jas

  6. Jason Harris repo owner

    - My Fixes to Eugene's contribution to annotate base and compare revisions in the differences view. - Things will change in the future but Eugene's change here is a reasonably simple stop gap in the meantime. - Fixes #200.

    Wiki macro error: Changeset 6ce5db344343 not found.

  7. Jason Harris repo owner

    - My Fixes to Eugene's contribution to annotate base and compare revisions in the differences view. - Things will change in the future but Eugene's change here is a reasonably simple stop gap in the meantime. - Fixes #200.

    Wiki macro error: Changeset 6ce5db344343 not found.

  8. Eugene Golushkov reporter

    Hello again, Jason!

    Unfortunately, there still are problems in differences view.

    First is minor - removed selector differencesMenuAnnotateSelectedFiles: is still referenced in one place of code - mea culpa.

    Other is more significant - identical files are shown as modified in differences view. I was able to repeat this problem in command line, and further tracked it down to the hg`s Python`s line of code, that was not so easy as I don`t speak Python :) Can you take a look, may be I missed something, and my fix is just wrong? Problem repeated quite often when fixes are manually transferred into the other branch, even by simple file copy.

    With best regards, Eugene Golushkov.

  9. Jason Harris repo owner

    Thanks for the fix Eugene!

    Ok as far as the mercurial change goes:

    is it fixing:

    hg init bob
    cd bob
    echo one > theFile
    hg commit -A -m "initial"
    echo two > theFile
    hg commit -m "secondary"
    echo one > theFile
    hg commit -m "change back"
    hg status --rev 0:2
    

    yields

    M theFile
    

    whereas it should yield nothing? Is that correct? I'll try and get to this later today...

    Thanks, Jas

  10. Jason Harris repo owner

    - My Fixes to Eugene's contribution to annotate base and compare revisions in the differences view. - Things will change in the future but Eugene's change here is a reasonably simple stop gap in the meantime. - Fixes #200.

    5929d47940f5

  11. Jason Harris repo owner

    I rolled the missing selector fix into your patch and repushed the changes. This will require a strip and repull from everyone that pulled these changes.

    Your fix for localRepo.py looks like its doing the right thing. It passed the tests in the Mercurial suite. I'll submit the patch upstream for you unless you want to...

    Thanks again!

    Cheers, Jas

  12. Log in to comment