The script is more or less finished for now, however there are a couple things I'd like to clean up and improve to make it a little more general purpose and easy to maintain. One of the big things that annoys me is the size of the script, right now it weighs in at about 1k lines. Luckily a lot of this is empty lines and heavy comments, however there are some areas I can refactor to improve readability and reduce duplication. Overall though, I'm very happy with how the script turned out. It took me about 6 days to get it thought out, designed and implemented up to this point. While this is longer than I hoped it would take, the results definitely speak for themselves. The person using this script has been extremely happy with it and how much time it saves him when he needs to do a Perforce sync.
One thing I had trouble with was analyzing Perforce actions in order to determine what to perform on the target server. From what I found, there are five file operations you need to be able to support (as of Perforce v2008.2):
- Add - Operation executed when a file is added to P4.
- Delete - Operation executed when a file is deleted from P4. Also issued when a renaming is done (old file is deleted)
- Branch - Operation executed when an existing file is copied to create a new, separate file. Also issued when a renaming is done (new file is branched). In both cases the new file's first operation will be 'branch', not 'add'.
- Integrate - Operation executed when an update from another file is integrated into the file in question. This is very similar to an 'edit' operation, however P4 tracks 'integrate' differently because there is now a relationship between the 2 files when an integration is done.
- Edit - Operation executed whenever a file is modified and submitted.
No comments:
Post a Comment