#ifndef FILEHEAD_H #define FILEHEAD_H #include "filelog.h" /* A FileRevArrow is a single pointer from one rev to another. It also * serves as a singly-linked-list node. */ enum ArrowType //how should this pointer be rendered? { edit, branch, copy, ignore, impure, merge }; enum Contrib //how much content contribution does this represent? { none, some, all }; enum RevType //what was the action that created this rev? { UNKNOWN_TYPE, EDIT, BRANCH, ADD, INTEG, DEL }; class FileHead; struct FileRevArrow { FileRev* ptr; ArrowType type; Contrib contrib; FileRevArrow* next; }; struct FileTextArrow { StrBuf file; StrBuf rev; ArrowType type; FileTextArrow* next; FileHead* fhead; }; enum CacheLocation { cl_unset, cl_from, cl_into, cl_main }; /* A FileHead object represents a file and all its revision history. Its name comes * from the fact that it's the head of a linked list of FileRev objects. The FileHead * is a part of a FileLogCache. */ class FileHead { public: FileHead(StrBuf, FileLogCache*); virtual ~FileHead(); FileHead* next; //This is the next FileHead in a "from" or "into" chain. //See FileLogCache for more info about its structure. /* These FileHeads are a more "absolute" line of links across the FileLogCache - * you can start at one end, follow one of these pointers, and make it all the way * to the other end. */ FileHead* next_from; FileHead* next_into; FileRev* head; //The FileRev corresponding to the head revision of this file. FileRev* tail; //The last created FileRev - in a complete FileHead this will be rev #1. FileLogCache* flc; //The FileLogCache that this FileHead is a part of. StrBuf name; //The Perforce path to this file, eg "//depot/foo/file". /* addRev adds a new revision to this FileHead, at the tail position. As * arguments it takes the revision number, the change number, the file * type, ane whether it's text. addRev is called once by ClientLogUser for each revision record * in a filelog. It is assumed that the revisions will be added in order * from head to first. */ void addRev(StrBuf newrev, StrBuf newchange, RevType, bool istext); /* scanInto is used to follow "into" integration records - it's a command for * this FileHead to locate the revision indicated by the 'startrev' argument, * and set its 'from' pointer to the 'caller' argument. This is its primary function. * Once this is done, it checks that revision and its successors to see if they were * integrated into other files, and calls scanInto on those files where necessary. In * this way, all of the children of children are found. The startrev argument is of * the form "14", and the caller argument is a pointer to the revision that was the source * of the integration that created revision 14. */ void scanInto(StrBuf startrev, FileRev* caller, ArrowType atype); /* scanFrom is similar to scanInto, but it does roughly the opposite. It returns the * FileRev object corresponding to the 'endrev' argument - this pointer is used * to establish a 'from' pointer from the caller file to this one. scanFrom also * checks all of the revisions before the endrev for "from" integration records, and * calls scanFrom on the referenced files. */ FileRev* scanFrom(StrBuf endrev); /* scanMain should only be called on the "main" FileHead. It performs sort of an * interleaved scanFrom and scanInto. */ void scanMain(); /* It's handy to know where in the FLC structure a given FileHead is. */ CacheLocation loc; /* ClientLogUser object which will channel filelog inputs into this FileHead */ ClientLogUser* ui; int size; //number of revs in this FileHead. }; /* A FileRev object represents a single file revision. */ class FileRev { public: /* Constructor - initializes the named variables. */ FileRev(StrBuf rev, FileHead* file, StrBuf change, RevType type, bool istext); /* Add a new FileRevArrow to this FileRev. */ void AddFromArrow(FileRev* rev, ArrowType atype); /* Add new FileTextArrows, to later be translated into FileRevArrows. */ void AddFromText(StrBuf& infile, StrBuf& inrev, ArrowType atype); void AddIntoText(StrBuf& infile, StrBuf& inrev, ArrowType atype); virtual ~FileRev(); FileRev* prev; //the previous FileRev in the linked list. FileRev* next; //the next FileRev in the linked list. FileHead* fh; //the FileHead this FileRev is a part of. StrBuf rev; //the rev number, eg "14". StrBuf change; //the change number, eg "123". RevType type; //the rev type bool fromcheck; //Has this rev been touched by scanFrom()? bool intocheck; //Has this rev been touched by scanInto()? FileRevArrow* fromarrows; //List of FileRev pointers to be rendered FileTextArrow* fromtexts; /* Textual descriptions to be turned into */ FileTextArrow* intotexts; /* pointers */ CBaseEntity* ent; //The CObjectRev created from this FileRev, if any. bool istext; }; #endif // FILEHEAD_H
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 7292 | Andrew McDonald | initial submittal | ||
//guest/sam_stafford/p4hl/src/dlls/FileHead.h | |||||
#17 | 1689 | Sam Stafford |
Integrate 02.1 API and code cleanup to P4HL. Lots of work. Phew. |
||
#16 | 1557 | Sam Stafford |
Integrate bug fix for testing. Looks good so far. |
||
#15 | 1548 | Sam Stafford |
Integrate RevType change to make sure it works. It does. |
||
#14 | 1521 | Sam Stafford |
Integrated change 1520 to P4HL. Updated CObjectFile::Expand() to use the new variable name. Infrastructure change. |
||
#13 | 1457 | Sam Stafford |
Use RunTag() to queue up filelog commands. Should in theory improve performance, although I haven't noticed any great difference. Integration only change. |
||
#12 | 1450 | Sam Stafford |
Major performance improvement - use one ClientApi connection for all filelogs. Improves querying time about tenfold on large requests! Had to move client->Final() to the constructor to ensure that connection is cleaned up promptly and doesn't hang things up. |
||
#11 | 1433 | Sam Stafford |
Integ display: if you see one of a file's revisions, you see them all. Previously, your view was limited to those revisions which were directly related to the file you asked about. However, if you asked about a file branched from the mainline, this meant that you couldn't see mainline changes that weren't yet integrated into your branch, and that's not terribly useful. |
||
#10 | 1420 | Sam Stafford |
Dummy integrate changes made thus far back to mainline, so it doesn't get propagated back there later. |
||
#9 | 1406 | Sam Stafford |
Code trimming. No functional change. |
||
#8 | 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. |
||
#7 | 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* |
||
#6 | 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. |
||
#5 | 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. |
||
#4 | 1007 | Sam Stafford |
A stab at making P4HL a bit more accessible to Perforce novices. During the Precache() phase of the P4HL objects, a "p4 info" is executed. If this returns any errors, odds are there's no server there (I can't think of what other error "p4 info" would return). If this happens, use "public.perforce.com:1666" as the new port value for all future Perforce transactions during this session, and send a message to the console explaining this. |
||
#3 | 1004 | Sam Stafford |
Different file types are now treated differently - the ObjectFiles have different skins depending on file type of the head rev, and non-text revisions will not attempt to display their contents when expanded. Possible bug: old-style filetypes might be detected wrong (ie "ktext" instead of "text+k"). I'd have to put in some pretty complex logic to make it completely foolproof and backwards-compatible. Right now it just errs on the side of thinking a file is text if there's any confusion. |
||
#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/FileHead.h | |||||
#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. |