// FileRev.cpp: implementation of the FileRev class. // ////////////////////////////////////////////////////////////////////// #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; 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 | |
---|---|---|---|---|---|
#8 | 1704 | Sam Stafford |
Change API includes to <*.h> rather than "*.h". No functional change. |
||
#7 | 1684 | Sam Stafford |
Imported new 02.1 p4api headers and libs. MAJOR code cleanup to make it fit without resorting to re-hacking of the API headers. The hacked headers were not L33T. They deserved D34TH. |
||
#6 | 1584 | Sam Stafford | New "numarrows" member of FLC to keep track of FileRevArrows. | ||
#5 | 1547 | Sam Stafford |
Moved revision type from #defined shorts to an enum, RevType. Infrastructure change. |
||
#4 | 1520 | Sam Stafford |
Make variable names slightly more sensical - expressions like "foo->file->file.Text()" look really bad. Now it's more like "fr->fh->name.Text()", which makes quite a bit more sense, at least if you're familiar with the structure. Infrastructure change. |
||
#3 | 1435 | Sam Stafford |
Avoid duplicate FileRevArrows by checking through the existing list for that rev. |
||
#2 | 1419 | Sam Stafford | Tweaking and edits to make it compile on its own. | ||
#1 | 1417 | Sam Stafford |
Branching backend stuff off for rigorous testing. Grahr. |
||
//guest/sam_stafford/p4hl/src/dlls/FileRev.cpp | |||||
#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. |