// FileRev.cpp: implementation of the FileRev class. // ////////////////////////////////////////////////////////////////////// #include "extdll.h" #include "util.h" #include "cbase.h" #include <clientapi.h> #include "filehead.h" #include "clientloguser.h" #include "changesorter.h" #include "filelogcache.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// FileRev::FileRev(StrBuf newrev, FileHead* parent, StrBuf newchange, RevType revtype, bool text) { rev = newrev; change = newchange; fh = parent; type = revtype; prev = NULL; next = NULL; fromcheck = false; intocheck = false; ent = NULL; istext = text; fromarrows = NULL; fromtexts = NULL; intotexts = NULL; } void FileRev::AddFromArrow(FileRev* rev, ArrowType atype) { /* Do a quick check to avoid duplicates. */ FileRevArrow* scan = fromarrows; while (scan) { if (scan->ptr == rev) return; //already got it! scan = scan->next; } fh->flc->numarrows++; if ( (type == EDIT || type == ADD) && (atype != edit) ) atype = impure; //sanity check for "impure" integs FileRevArrow* newarrow = new FileRevArrow; newarrow->ptr = rev; newarrow->type = atype; switch (atype) { case edit: case branch: case copy: newarrow->contrib = all; break; case ignore: newarrow->contrib = none; break; case impure: case merge: newarrow->contrib = some; break; } newarrow->next = fromarrows; fromarrows = newarrow; /* Downgrade "contrib" of other arrows as needed. */ scan = fromarrows->next; while (scan) { switch (fromarrows->contrib) { case all: scan->contrib = none; break; case some: if (scan->contrib == all) scan->contrib = some; break; } scan = scan->next; } } void FileRev::AddFromText(StrBuf& infile, StrBuf& inrev, ArrowType atype) { FileTextArrow* newtext = new FileTextArrow; newtext->file.Set(infile); newtext->rev.Set(inrev); newtext->type = atype; newtext->next = fromtexts; fromtexts = newtext; } void FileRev::AddIntoText(StrBuf& infile, StrBuf& inrev, ArrowType atype) { FileTextArrow* newtext = new FileTextArrow; newtext->file.Set(infile); newtext->rev.Set(inrev); newtext->type = atype; newtext->next = intotexts; intotexts = newtext; } FileRev::~FileRev() { FileRevArrow* rmg; while (fromarrows) { rmg = fromarrows->next; delete fromarrows; fromarrows = rmg; } if (next != NULL) delete next; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#14 | 1709 | Sam Stafford |
Propagate bug fix and include change from p4hltest. No functional change - P4HL never used "numarrows" so the bug doesn't affect it. |
||
#13 | 1689 | Sam Stafford |
Integrate 02.1 API and code cleanup to P4HL. Lots of work. Phew. |
||
#12 | 1586 | Sam Stafford | Migrate outstanding changes into P4HL - no functional change. | ||
#11 | 1548 | Sam Stafford |
Integrate RevType change to make sure it works. It does. |
||
#10 | 1521 | Sam Stafford |
Integrated change 1520 to P4HL. Updated CObjectFile::Expand() to use the new variable name. Infrastructure change. |
||
#9 | 1436 | Sam Stafford | Integrate no-duplicate-pointer change to P4HL. | ||
#8 | 1420 | Sam Stafford |
Dummy integrate changes made thus far back to mainline, so it doesn't get propagated back there later. |
||
#7 | 1406 | Sam Stafford |
Code trimming. No functional change. |
||
#6 | 1405 | Sam Stafford |
Phew - this was a big one! New functionality: The rare case in which a revision has multiple parents, due to multiple resolves before submit, is now handled properly. There is no limit on the number of "parents" a revision may have. Integration lines are now always "weighted" to indicate whether they contributed all, some, or none to the target. For example, a "branch" line will be very solid and wide, whereas an "ignore" will be thin and faint. Rearchitecture: Now using low-cost structs to keep track of integration information. Also being just a little more efficient with scanning through large data structures. Quite a bit of general code bloat trimmed off now that some of the kludges are gone. Possible problems: Not sure yet, but it might happen that "duplicate" integration pointers will be created, now that it's not a single variable which would get overwritten in the event of a duplicate. to-do: Trim off obsolete member variables. Use more enums and fewer #defs. |
||
#5 | 1394 | Sam Stafford |
More support for FileRevArrows, including the addition of the FileTextArrow that will replace the ListList. As of right now the old functionality is untouched and I've just been adding stuff on. Submitting now because I've reached the point where I have to start making changes that have a high chance of breaking stuff. *cringe* |
||
#4 | 1372 | Sam Stafford |
Introduction of the FileRevArrow struct - ultimately all of the various FileRev pointers will be kept in the form of these happy little things, each of which is designed to be easily converted into a colored arrow, without having to go consult separate ListLists. No functional change whatsoever. |
||
#3 | 1008 | Sam Stafford |
Fixed a bug with the whole "istext" thing - wasn't setting the bit on CObjectRevs other than "main", so they'd all default to false. Now it seems to be better. Also cleaned up the style a little bit by including istext in the constructors, rather than setting it after construction. |
||
#2 | 974 | Sam Stafford |
Partial fixes to the sorting of a FileLogCache as it's created. FileRevs are now doubly-linked. FileHead now has a scanMain() function that acts as an interleaved scanFrom and scanInto. The next step will be to have scans go from #1 to #head (this is why FileRevs are now doubly linked). |
||
#1 | 937 | Sam Stafford |
Renaming my guest directory to the more conventional sam_stafford. |
||
//guest/samwise/p4hl/src/dlls/FileRev.cpp | |||||
#1 | 936 | Sam Stafford |
Adding P4HL to the public depot. See relnotes.txt for installation instructions; all relevant files are under p4hl/dist. Source code is under p4hl/src in the form of a VC++ project. |