[p4python] can't seem to pass a changeList # as an argument top4c.run_add()

John Burk jburk at radical.ca
Mon Aug 15 14:07:24 PDT 2005


Thangya vurry mudge...  Still new to python, but having survived 11
years of perl, python seems pretty quick on the uptake...

That does indeed work.  And p4.run_add() will also take an array (oops,
sorry, a 'list'), so to add all files in one pass, do this:

	newFiles.insert( 0, '-c' )
      newFiles.insert( 1, cLNum )
        
      try:
          cmdResult = p4Session.run_add( newFiles )
          for l in cmdResult: print l
      except p4.P4Error:
          for e in p4Session.errors:
              print e


johnb
-----Original Message-----
From: Smith, Jeff [mailto:jsmith at medplus.com] 
Sent: Monday, August 15, 2005 1:45 PM
To: John Burk; p4python at perforce.com
Subject: RE: [p4python] can't seem to pass a changeList # as an argument
top4c.run_add()

I think the problem is that you've passed it one argument
	-c 124 c:\p4\uds\art\game\locations\global\ftree\empty_file
and you should pass in three
	-c
	124
	c:\p4\uds\art\game\locations\global\ftree\empty_file

You should use
	cmdResult = p4Session.run_add( '-c', cLNum, f )

Jeff

P.S. Note this is untested and confirmation is left as an exercise for
the reader :-)

-----Original Message-----
From: John Burk [mailto:jburk at radical.ca] 
Sent: Monday, August 15, 2005 4:34 PM
To: p4python at perforce.com
Subject: [p4python] can't seem to pass a changeList # as an argument
top4c.run_add()


Python: ActivePython 2.4.1 Build 247
p4Python: P4Python-0.6.win32-py2.4.exe

I can successfully open files for add to the default changeList, but I'm
unable to open them for add to a specific changeList.


	  cLNum = newChangeList( p4Session,
				 "adding new empty files to game at " +
gameRoot )

        for f in newFiles:
            cmdArgs = '-c' + cLNum + ' ' + f
            print "cmdArgs: " cmdArgs
            try:
                cmdResult = p4Session.run_add( f )
                print cmdResult
            except p4.P4Error:
                for e in p4Session.errors:



All well and good, here's the output from the above:

	cmdArgs: -c 119
c:\p4\uds\art\game\locations\global\ftree\empty_file
	['//uds/art/game/locations/global/ftree/empty_file#1 - opened
for add']


But if I try and run:

      cmdResult = p4Session.run_add( cmdArgs )

I get:

	cmdArgs:-c 124
c:\p4\uds\art\game\locations\global\ftree\empty_file
	Usage: add/edit/delete [-c changelist#] [ -f ] [-t type]
files...
	Missing/wrong number of arguments.

ChangeList #124 does indeed exist:

	C:\P4\uds>p4 describe 124
	Change 124 by jburk at jburk-atgPC on 2005/08/15 13:25:05 *pending*

        adding new empty files to game at c:\p4\uds

	Affected files ...



Any ideas?

John Burk



_______________________________________________
p4python mailing list
p4python at maillist.perforce.com
http://maillist.perforce.com/mailman/listinfo/p4python




More information about the p4python mailing list