wokim / node-perforce

A simple library for perforce
MIT License
14 stars 13 forks source link

p4.changes examples #14

Open cope opened 9 years ago

cope commented 9 years ago

Could you please give an example for the changes command?

Particularly how do we use the parameters listed here: http://www.perforce.com/perforce/r15.1/manuals/cmdref/p4_changes.html

For example, how could I add option "@2011/04/01,@now" to that call?

p4 changes @2011/04/01,@now
gmaghera commented 8 years ago

Here you go:

var p4 = require('node-perforce');

p4.changes({files: ['@2015/12/23,@now']}, function(err, result){
    console.log(result);
});
cope commented 8 years ago

9d6x6pm_700wa_0

gmaghera commented 8 years ago

I've updated the example, as it was incorrect. The revision range argument needs to be placed inside a JSON object, and not as a string as I had in the initial example. There is a limit to how much data you can extract this way. If the revision range returns a huge number of changes, you'll get a buffer error.

Sorry to lead you astray with the previous example. It ended up outputting all the changes, not just the ones defined in the revision range. I happened to be working in a DVCS Perforce environment, where there was only one change, which matched the revision range by coincidence.