// Called once per changelist void OutputInfo( char level, const char *data ) { string d(data); Conn().VerboseLine(d); const size_t minLength = 8; // "Change x".length() if (d.length() <= minLength) { Conn().WarnLine(string("p4 changelist too short: ") + d); return; } // Parse the change list string::size_type i = d.find(' ', 8); if (i == string::npos) { Conn().WarnLine(string("p4 couldn't locate revision: ") + d); return; } Changelist item; item.SetDescription(d.substr(i+1)); item.SetRevision(d.substr(minLength-1, i - (minLength-1))); Conn() << item; }
virtual bool Run(P4Task& task, const CommandArgs& args) { ClearStatus(); Conn().Log().Info() << args[0] << "::Run()" << Endl; const string cmd = string("changes -s pending -u ") + Quote(task.GetP4User()) + " -c " + Quote(task.GetP4Client()); Conn().BeginList(); // The default list is always there Changelist defaultItem; const char * kDefaultList = "default"; defaultItem.SetDescription(kDefaultList); defaultItem.SetRevision(kDefaultListRevision); Conn() << defaultItem; task.CommandRun(cmd, this); Conn().EndList(); Conn() << GetStatus(); // The OutputState and other callbacks will now output to stdout. // We just wrap up the communication here. Conn().EndResponse(); return true; }