clientuserruby.h #13

  • //
  • guest/
  • perforce_software/
  • p4ruby/
  • main/
  • clientuserruby.h
  • Commits
# Change User Description Committed
#13 14682 Git Fusion Git Fusion branch management

Imported from Git
 ghost-of-change-num: 960958
 ghost-of-sha1: 005052ae424bd69f426f7209e741ca1c8c3253c7
 ghost-precedes-sha1: ad052c71a568ef12165e143a6866ad9ceffbb4a1
 parent-branch: None@960958
 push-state: incomplete
#12 14650 jmistry Progress indicator for P4Ruby.

There is a new class P4::Progress that is set up to be subclassed by a user.
It has the following interface and P4Ruby expects the following class methods to
be defined by the user (even if it's an empty implementation):

    class Progress:
        def init(type)
        end

        def description(description, units )
        end

        def total( total )
        end

        def update( position )
        end

        def done( fail )
        end
    end

Users need to create a subclass of P4::Progress and assign an instance to P4
to enable the progress indicator:

class MyProgress < P4::Progress
    def update(pos):
       # do something with the value here

    # other methods

p4 = P4.new
p4.progress = MyProgress.new

New feature to be documented in the release notes.
#11 14629 jmistry Implemented 'action resolve' in P4Ruby.

This extends the existing P4MergeData class to support action resolve.  Users
will need to test the MergeData object passed to the block to determine if the
resolve is for content (P4::MergeData#content_resolve?) or action
(P4::MergeData#action_resolve?).  The attributes available in
'P4::MergeDatamerge' for an action resolve are:

merge_action : The action chosen for the merge, can be emtpy
yours_action: your action/filetype
their_action: their action/filetype
type: the type of merge. Can be
         "Branch resolve",
         "Filetype resolve",
         "Delete resolve"
         "Filename resolve"
info: a dictionary with additional information that can vary with the resolve
type.

Updated unit test to test action resolve.

User visible change, to be documented in the release notes for 2012.1.
#10 14626 jmistry raise exceptions in P4#run_resolve

Any exceptions raised during the block passed to P4#run_resolve were silently
swallowed.  We still use 'rb_protect()' to run the block in the user's script;
however, we now stash where the exception happened in 'rubyExcept' (a member of
'ClientUserRuby') instead of just a local variable.  After running a command, I
now run 'ClientUserRuby::RaiseRubyException()' - if an exception has been
caught by 'rb_protect()' we now run 'rb_jump_tag()' to jump to the exception
and raise it up.

User visible change to be documented in release notes.
#9 14622 jmistry Pull 10.2 changes to main

Pick up missing changes in p10.2 and integrate to main.

As part of the integrate I also moved the unit tests '16_streams.rb' and
'17_streaming_handler.rb' because the integration introduced collisions with
the unit test names. Updated MANIFEST with new names for unit tests and also
added '98_unicode.rb', which was missing from it.
#8 14593 Sven Erik Knop P4Ruby implementation of OutputHandler.
Also, debug is now treated as a normal attribute and can be read.

Test cases still missing.

New functionality, to be documented in release notes.
#7 14589 Sven Erik Knop Pulled P4Ruby p10.2 changes back to main.
#6 14579 tony Make new class P4::Message for returning Error objects
to the user. Currently handles errors and warnings, but
could potentially be used for output too (might bloat
people's code though).

Essentially, if you're using a 2010.2 or later client,
or if you've set your api_level to 68 or higher, the
P4#errors and P4#warnings arrays will be populated
with P4::Message objects instead of strings. Users of
older API's, or those who set their api_level to 67
or lower in their scripts will get the old behaviour.

P4::Message objects have the following methods:

  severity() - returns the severity
  generic()  - returns the generic code
  to_s()     - converts the message to a string
  inspect()  - returns a string showing the message details.

User-visible enhancement documented in p4rubynotes.txt
#5 14541 tony Copyright notice housekeeping: update all notices to 2008, and
correct start date from 1997 to 2001 when P4Ruby was first released
from the public depot.

No functional change
#4 14521 tony Update copyright notices in all applicable P4Ruby files.
#3 14502 tony Rework spec handling somewhat so that:

(a) P4Ruby knows about the default spec types for 2007.2 so it
    doesn't have to connect to the server to parse and format specs,
    and nor does it have to do the ugly hack of running a 'p4 xxx -o'
    and discarding the result just to get the specDef.

(b) If a user's got a custom spec then the spec cache will be updated
    if they fetch an object of that type. So basically, if the
    server's given us a specdef for a class of spec, we use it.
    Otherwise, we fall back on the builtin defaults

This reworks SpecMgr quite a bit - renaming methods so it's clearer
what they do, and making it own the spec cache. We also pass the
SpecMgr object created by P4ClientApi down to ClientUserRuby now,
so that whenever the server sends us a spec, we can update the cache.
#2 14484 tony Remove the old const_char macro from P4Perl and P4Ruby (P4Python
never used it). Since we're going to insist on an API later than
2006.1, we can ditch this piece of legacy compatibility.
#1 14480 tony Add P4Ruby 1.5944 to main as start-point for the first
productized release of P4Ruby