Class: Perforce::Changelist
Overview
A Perforce changelist.
Use Perforce#new_changelist to create a new changelist.
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Changelist number.
Instance Method Summary collapse
-
#add_files(*files) ⇒ Object
Add files to this Changelist.
-
#delete ⇒ Object
If empty, delete this Changelist.
-
#delete_files(*files) ⇒ Object
Open files for deletion.
-
#description ⇒ Object
Description of this changelist.
-
#empty? ⇒ Boolean
True if there are no files in this Changelist.
-
#files ⇒ Object
Files in this Changelist.
-
#info ⇒ Object
Info hash for this Changelist.
-
#initialize(perforce, number) ⇒ Changelist
constructor
:nodoc:.
-
#revert_files(*files) ⇒ Object
Revert these files in this changelist.
-
#revert_unchanged_files(files = nil) ⇒ Object
Revert unchanged files in this Changelist.
-
#status ⇒ Object
Status of this changelist.
-
#submit ⇒ Object
Submit this Changelist.
Constructor Details
#initialize(perforce, number) ⇒ Changelist
:nodoc:
291 292 293 294 |
# File 'lib/perforce.rb', line 291 def initialize(perforce, number) #:nodoc: @perforce = perforce @number = number end |
Instance Attribute Details
#number ⇒ Object (readonly)
Changelist number.
299 300 301 |
# File 'lib/perforce.rb', line 299 def number @number end |
Instance Method Details
#add_files(*files) ⇒ Object
Add files to this Changelist.
This is used for both editing files and adding new files.
306 307 308 309 310 311 312 |
# File 'lib/perforce.rb', line 306 def add_files(*files) files = files.flatten unless files.empty? @perforce.run("edit", "-c", @number, *files) @perforce.run("add", "-c", @number, *files) end end |
#delete ⇒ Object
If empty, delete this Changelist.
356 357 358 359 360 |
# File 'lib/perforce.rb', line 356 def delete if empty? @perforce.run("change", "-d", @number) end end |
#delete_files(*files) ⇒ Object
Open files for deletion. This action is added to the changelist.
327 328 329 330 331 332 |
# File 'lib/perforce.rb', line 327 def delete_files(*files) files = files.flatten unless files.empty? @perforce.run("delete", "-c", @number, *files) end end |
#description ⇒ Object
Description of this changelist
379 380 381 |
# File 'lib/perforce.rb', line 379 def description info["Description"] end |
#empty? ⇒ Boolean
True if there are no files in this Changelist.
349 350 351 |
# File 'lib/perforce.rb', line 349 def empty? not @perforce.run("describe", @number).first.has_key?("depotFile") end |
#files ⇒ Object
Files in this Changelist.
372 373 374 |
# File 'lib/perforce.rb', line 372 def files info["Files"].to_a end |
#info ⇒ Object
Info hash for this Changelist.
365 366 367 |
# File 'lib/perforce.rb', line 365 def info @perforce.run("change", "-o", @number).first end |
#revert_files(*files) ⇒ Object
Revert these files in this changelist.
317 318 319 320 321 322 |
# File 'lib/perforce.rb', line 317 def revert_files(*files) files = files.flatten unless files.empty? @perforce.run("revert", "-c", @number, *files) end end |
#revert_unchanged_files(files = nil) ⇒ Object
Revert unchanged files in this Changelist.
393 394 395 396 397 398 |
# File 'lib/perforce.rb', line 393 def revert_unchanged_files(files = nil) files = (files && files.flatten) || self.files unless files.empty? @perforce.run("revert", "-a", "-c", @number, *files) end end |
#status ⇒ Object
Status of this changelist
386 387 388 |
# File 'lib/perforce.rb', line 386 def status info["Status"] end |
#submit ⇒ Object
Submit this Changelist.
337 338 339 340 341 342 343 344 |
# File 'lib/perforce.rb', line 337 def submit revert_unchanged_files if empty? delete else @perforce.run("submit", "-c", @number) end end |