require 'helix_web_services_client/open_model' require 'open-uri' class HelixWebServicesClient # List changelists in the system # # options: # - :max - cap the number of results # - :status - :pending, :submitted, or :shelved (see Change) # - :user - The perforce login to check out # - :files - Depot path pattern to restrict changes to def changes(options = nil) arr = execute_method_no_body(:get, hve_path('changes'), options) arr.map { |obj| OpenModel.new(obj) } end # Returns the Change indicated by the change number or model. # # If there are files submitted with the change, the change.files field # should be filled out. def change(change) change_id = change.is_a?(OpenModel) ? change.change : change arr = execute_method_no_body(:get, hve_path("changes/#{change_id}")) OpenModel.new(arr.first) end # Creates a new changelist, that can be used for a few different tasks. # # The change should be a hash with the following top-level keys: # # - `Description`: The change description (optional) # # - `Files`: An array of Hashes # # Each hash in the `Files` array can contain these keys: # # - `DepotFile`: The depot path # # - `Action`: One of 'upload', 'move', or 'branch' # # - `FromDepotFile`: if action is 'move' or 'branch', the source file # # - `Content`: Base64-encoded file content for 'upload' actions # # - `RequireVersion`: Optional value for 'upload' actions, if set, will # fail the upload if the current file version is not # this version. # # @param change [Hash] See method description def create_change(change) change = OpenModel.new(change) unless change.is_a?(OpenModel) execute_method_with_body(:post, hve_path('changes'), nil, change.marshal_dump) end # Submits the shelved changelist. # # This changelist should be pending, with no open files, and list of shelved # changes. If you require resolves, this method will fail. # # @param change [String] The changelist number def commit_change(change) change_id = change.is_a?(OpenModel) ? change.change : URI.encode(change) execute_method_no_body(:post, hve_path("changes/#{change_id}")) end end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15741 | ptomiak | Branch HWS for my use. | ||
//guest/perforce_software/helix-web-services/main/source/helix_web_services_client/lib/helix_web_services_client/changes.rb | |||||
#1 | 15622 | tjuricek |
Move source code to 'source/' subdirectory of branch. build/ will remain where it is. |
||
//guest/perforce_software/helix-web-services/main/helix_web_services_client/lib/helix_web_services_client/changes.rb | |||||
#5 | 15240 | tjuricek |
Set api level via request path on all Helix Versioning Engine methods. This will allow migration of applications to different P4D versions. Our internal methods (like project API) should attempt to handle backward compatibility similarly. P4WEBAPI-118 |
||
#4 | 15132 | tjuricek | Provde a basic submit -e mechanism on classic perforce workspaces. | ||
#3 | 15110 | tjuricek | Revise changes methods for new p4 connection handling, add server specs, remove model references in client, and update asciidoc documentation. | ||
#2 | 15077 | tjuricek |
Add new 'model' technique, revised branch spec operations, test Auth::Middleware. The Ruby client now does *not* strictly type anything, but extends OpenStruct with helper methods to help deal with inconsistent data formats. See the OpenModel class documentation for more details. The Auth::Middleware class is also *finally* implemented as well. This does not take into account all possible variations of server behavior (yet), but that will happen in follow-up work. |
||
#1 | 13808 | tjuricek | Finish converting most of the core p4d API into the new monolithic system. | ||
//guest/perforce_software/helix-web-services/main/p4_web_api/clients/ruby/p4_web_api_client/lib/p4_web_api_client/client/changes.rb | |||||
#1 | 13412 | tjuricek |
Initial version of the web-services mainline. This is a collection of several projects, that will likely often get released together, though many of them may not always be relevant. See the README for more information. |