DARev.cpp #1

  • //
  • guest/
  • sam_stafford/
  • deepannotate/
  • DARev.cpp
  • View
  • Commits
  • Open Download .zip Download (914 B)
#include "DARev.h"

#include "DAInteg.h"

DARev::DARev( int n, int c )
: num( n ), change( c ), isEdited( false )
{
	icount = 0;
	istack = 0x0;
}

DARev::~DARev(void)
{
	DAInteg* next;
	while ( istack )
	{
		next = istack->Next();
		delete istack;
		istack = next;
	}
}

DAInteg* DARev::addInteg( int h, const StrPtr* f, int s, int e )
{
	DAInteg::How how = (DAInteg::How)h;
	//Downgrade "how" if revision was edited.
	if ( isEdited )
	{
		switch( how )
		{
		case DAInteg::Branch:
			how = DAInteg::Add;
			break;
		case DAInteg::Copy:
		case DAInteg::Merge:
		case DAInteg::Ignore:
			how = DAInteg::Edit;
			break;
		}
	}

	icount++;
	istack = new DAInteg( istack );
	istack->Init( (DAInteg::How)how, f, s, e );
	return istack;
}

DAInteg* DARev::getInteg( int i )
{
	if ( i >= icount || i < 0 ) return 0x0;
	DAInteg* integ = istack;
	for ( ; i && integ ; i-- )
	{
		integ = integ->Next();
	}
	return integ;
}

# Change User Description Committed
#3 6299 Sam Stafford Ditch the attempts at only processing lines that have already been
connected to the starting file.  It seemed to be causing more
backtracking than anything else when the history was complex, and
iterating through all files/revisions works just as well and isn't
nearly as prone to duplicating work.
#2 6298 Sam Stafford Add some new sanity checks.
 One prevents an infaloop observed while
testing against a file with especially twisted history; the other may
help with future tweaks to the zipper algorithm.
#1 6297 Sam Stafford Work so far on "deep annotate".
 Been getting a lot of questions on
this lately from other people working on the same thing; might as well
pool efforts.