// FileHead.h: interface for the FileHead class. // ////////////////////////////////////////////////////////////////////// #ifndef FILEHEAD_H #define FILEHEAD_H #include "filelog.h" #include "strbuf.h" #include "clientloguser.h" #include "clientapi.h" #include <stdlib.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". StrBuf oname; //The original name used to refer to this 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 */ bool istext; }; #endif // FILEHEAD_H
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#13 | 2944 | Sam Stafford |
Add the ability to read filelog output from a text file. This functionality (if used; it's off by default) causes FLC to try to find required filelog output from a specified file before it queries the server. This can be used to fill in gaps (eg obliterated files), or more importantly, to draw graphs based on filelog output from a server you don't have access to, such as when trying to diagnose an integration problem for a customer. The filelog-parsing code hasn't been changed much, and isn't very fault-tolerant, so it might crash if fed mangled filelogs. Let the user beware. |
||
#12 | 1685 | Sam Stafford |
Changes to p4hltest that didn't get submitted properly... boggle? |
||
#11 | 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. |
||
#10 | 1556 | Sam Stafford |
Undo 1540 and 1552 and do things right. Preliminary tests seem to indicate that everything works, but I've been taught to tread more cautiously in the future. Need to re-implement the error-checking to enforce the "one file per FileHead" rule. |
||
#9 | 1552 | Sam Stafford |
Quick and kludgey fix to bug introduced by change 1540. Fix probably has to do with combination of using filelog output to fill in the name of a FileHead, using tags to run filelogs asynchronously, and preloading a bunch of FileHead pointers at once. The kludge: store the name which was originally used to create the FileHead and use that in comparisons. The better fix (to be done later): call WaitTag() if needed to fill in the FileHead and get the name of the file. The problem with the current kludge is that it still won't work if the file's "oname" isn't in depot syntax, which is what change 1540 was supposed to address in the first place. Grahr. |
||
#8 | 1550 | Sam Stafford | Add a "size" variable to the FileHead. | ||
#7 | 1547 | Sam Stafford |
Moved revision type from #defined shorts to an enum, RevType. Infrastructure change. |
||
#6 | 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. |
||
#5 | 1456 | Sam Stafford |
Use RunTag() and WaitTag() to perform filelogs asynchronously. This is risky because queueing multiple commands with RunTag() is unsupported and known to have problems, but it can also potentially cut lag time in half. |
||
#4 | 1451 | Sam Stafford |
Reverse integrate the move of client->Final() from destructor to constructor. Dummy integrate FileHead.h because the two branches are in sync now. |
||
#3 | 1432 | Sam Stafford |
Visible change: ALL revisions are now kept in the ChangeSorter, not just those that are "relevant". I've decided that the mechanism of filtering for revisions with direct relationships isn't all that useful, even if it's sort of interesting - it prevents you from seeing work in ancestor branches that you haven't yet integrated, for example. Infrastructure change: New set of FileHead* links to help in navigation of the FileLogCache: pointers in the FileLogCache to "head" and "tail" FileHeads, and "next_from" and "next_into" pointers on each FileHead. The idea is you can start at the "head" and then follow "next_into" pointers all the way to the "tail". |
||
#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/FileHead.h | |||||
#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. |