DeepAnnotate

From PDWiki

Jump to: navigation, search

Contents

About this project

DeepAnnotate is a first attempt at combining p4 annotate output with integration history to produce a record of when each edit was originally introduced and in what codeline.

Like Rollback, it is designed to easily hook into applications that use the Perforce C++ API.

Command line usage

deepannotate [-aq] file

The output produced is identical to that of p4 annotate, except that revisions are always reported as changelists, and may not pertain directly to the starting file. The -a and -q options work exactly like the ones passed to p4 annotate.

API usage

The "deepannotate" command can be executed in a P4API application almost exactly as if it were a normal server-side command by instantiating a DeepAnnotate object (declared in DeepAnnotate.h) and calling the following function:

void DeepAnnotate::Run( ClientApi* c, ClientUser* ui, int argc, char** argv );

This function call behaves very much like a call to ClientApi::Run(). It requires that the supplied ClientApi object have an initialized connection (as before a normal Run()), and all of the output from the command will be passed back through the supplied ClientUser. If the "tag" protocol is enabled on the ClientApi, output will be passed back in tagged form via OutputStat() as with most server commands.

Work in progress

The logic used to connect lines to one another is a bit convoluted and still a work in progress. Feel free to email me or leave a note on the talk page if you have questions or ideas for improvement.

To do

  • Add support for -d whitespace flags.
  • Add file paths to tagged output.
  • Try to simplify the more tangled bits of code.

Recent Changes RSS_Feed.gif

  • Change 6304 on 2008/04/03 by sam_stafford@samwise-silver
      Add a Jamrules check for the P4APIDIR variable and wrap the P4API
      includes in a rule so that they're optional.
  • Change 6302 on 2008/04/02 by sam_stafford@samwise-silver
      Jamming DeepAnnotate.
  • Change 6300 on 2008/03/30 by sam_stafford@samwise-silver
      DeepAnnotate build.
  • Change 6299 on 2008/03/29 by sam_stafford@samwise-silver
      Ditch the attempts at only processing lines that have already been
      connected to the starting file. It seemed to be causing more
      backtracking than anything else when the history was complex, and
      iterating through all files/revisions works just as well and isn't
      nearly as prone to duplicating work.
  • Change 6298 on 2008/03/28 by sam_stafford@samwise-silver
      Add some new sanity checks. One prevents an infaloop observed while
      testing against a file with especially twisted history; the other may
      help with future tweaks to the zipper algorithm.

License

Copyright (c) 2008, Sam Stafford. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Personal tools