Giter Site home page Giter Site logo

node-perforce's Introduction

node-perforce

A simple library for perforce

Install

npm install node-perforce --save

Example

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

// create a new changelist
p4.changelist.create({description: 'hello world'}, function (err, changelist) {
  if (err) return console.log(err);
  console.log('changelist:', changelist);
});

// view changelist info
p4.changelist.view({changelist: changelist}, function (err, view) {
  if (err) return console.log(err);
  console.log(view);
});

// edit changelist 1234
p4.changelist.edit({changelist: 1234, description: 'hi world'}, function (err) {
  if (err) return console.log(err);
});

// delete changelist 1234
p4.changelist.delete({changelist: 1234}, function (err) {
  if (err) return console.log(err);
});

// add files into CL@1234
p4.add({changelist: 1234, filetype: 'binary', files: ['*.bin']}, function(err) {
  if (err) return console.log(err);
});

// revert files
p4.revert({files: ['*.bin']}, function(err) {
  if (err) return console.log(err);
});

// edit files
p4.edit({files: ['*.js']}, function(err) {
  if (err) return console.log(err);
});

node-perforce's People

Contributors

cope avatar flonker avatar gmaghera avatar heycalmdown avatar joebach71 avatar mattsawyer77 avatar unional avatar wokim avatar zimme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-perforce's Issues

Multi line description when editing is not working

Hi,
I am trying to edit a file with a description that is on multiple line. As this is getting picked up by some automated tools, i need to make sure it is on multiple line.

The following will return an error:
_```
build_description="
First Line\n
Second Line\n
Third Line\n
"

p4.changelist.create({description: build_description}, function (err, changelist) {
if (err) return console.log(err);


I was able to fix it locally. I have never contributed so I'm not sure what the process is so here is what I did to fix it:
`
  if (ob.stdin.length > 0) {
    ob.stdin.forEach(function (line) {
      // for multline field, the first line goes in as is, and the following need to start with a tab
      let multiline = line.split('\n')
      child.stdin.write(multiline[0] + '\n');
      multiline.shift();
      multiline.forEach(function (l) {
        child.stdin.write('\t' + l + '\n');
      });
    });
    child.stdin.emit('end');
  }
`
Bascially, I followed how they are doing with the files for multilines, which is to add a tab for each new line that belongs to the same tag.

p4.view ?

Do yo plan to add a p4.view method, where the return would be a list of changelists based on a given criteria?

For example "get all changelists with id greater than 1122334", or "get all changelists younger than 5 days", or "get all changelists submitted after Oct. 21st 2015" and so on.

This would be a very helpful and awesome feature, IMHO.

revert unchanged

Hi!
Could you give an example how to perform revert unchanged? please please?

Initial settings

Hi,

Now I have Perforce visual client and it works well. When I run this GULP task

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

gulp.task('default', function() {
p4.changelist.create({description: 'hello world'}, function (err, changelist) {
if (err) return console.log(err);
console.log('changelist:', changelist);
});
});

I have this error in console
$ gulp
[17:52:13] Using gulpfile c:\Dev\perforce\gulpfile.js
[17:52:13] Starting 'default'...
[17:52:13] Finished 'default' after 6.45 ms
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "p4.exe change -i "
Client 'IT04' unknown - use 'client' command to create it.
]
killed: false,
code: 1,
signal: null,
cmd: 'C:\Windows\system32\cmd.exe /s /c "p4.exe change -i "' }

I need to write credentials somewhere and most probably do some settings as well. I am new with communication between Perforce and Node.js. Can you please give a bit of links/references/ideas for initial settings before using your plugin. I mean how to setup Perforce to be able run your functionality from GULP tasks. What I need to do first to be able to use your code examples from
https://www.npmjs.com/package/node-perforce

thanks a lot in advance,
Alex

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.