List Info

Thread: force sync




force sync
user name
2006-08-01 14:15:21
where can I get detailed description of p4::Sync command.
Our requirement is to force sync to a particular label. How can do this?
 
Thanks in advance.
Suman

 


Groups are talking. We´re listening. Check out the handy changes to Yahoo! Groups.
force sync
user name
2006-08-01 15:46:11
If you looked at the source code of the P4.pm module, you'll notice that the "P4::Sync" subroutine isn't defined there. This isn't uncommon in Perl modules. When you create a Perl module, you can take a shortcut defining all the subroutines (or methods if you prefer object oriented syntax) in that module by creating an AUTOLOAD subroutine. Basically, any undefined call to a subroutine is handled by the AUTOLOAD subroutine.
 
If you look at the P4::AUTOLOAD subroutine, you'll notice that any call to the P4 module that doesn't start with "Fetch", "Parse", "Save", or "Format" is merely translated directly into the P4::Run subroutine, so that any call to the P4 module in the form of:
 
P4::<Cmd>(<parameters&gt;)
 
Is translated as:
 
P4::Run("&lt;cmd>", "<parameters>);
 
So, to force a sync, all you need to do is:
 
$p4->Sync("-f");
 
which is run by the AUTOLOAD command as:
 
$p4->Run("sync", "-f");
 
By using an AUTOLOAD subroutine, the P4.pm module allows you to run any P4 command without the authors having to write an actual subroutine to handle that specific&nbsp;P4 command. For example, you can do things such as
 
$p4->Info();
$p4->Counter("review 1001");
$p4->Where("foo.cpp");
 
 

From: p4perl-bouncesperforce.com [mailto:p4perl-bouncesperforce.com] On Behalf Of mehta suman
Sent: Tuesday, August 01, 2006 10:15 AM
To: p4perlperforce.com
Subject: [p4perl] force sync

where can I get detailed description of p4::Sync command.
Our requirement is to force sync to a particular label. How can do this?
 
Thanks in advance.
Suman


Groups are talking. We´re listening. Check out the handy changes to Yahoo! Groups.
force sync
user name
2006-08-02 05:17:14
Thanks for your prompt response..
 
Could you please also tell me what command gets run at perforce commandline when we issue P4::Run("&lt;cmd>", "<parameters>); from perl.
 
is this converted in to below command?
p4 <cmd>; <parameters>

if yes then ,"p4 sync -f //depot/automation/color/inxIDColor1.js" works at command line but
$p4->Run("sync","-f  //depot/automation/color/inxIDColor1.js"); fails.
 
thanks again
Suman
"Weintraub, David" <david.weintraubbofasecurities.com>; wrote:
If you looked at the source code of the P4.pm module, you'll notice that the "P4::Sync" subroutine isn't defined there. This isn't uncommon in Perl modules. When you create a Perl module, you can take a shortcut defining all the subroutines (or methods if you prefer&nbsp;object oriented syntax)&nbsp;in that module by creating an AUTOLOAD subroutine. Basically, any undefined call to a subroutine is handled by the AUTOLOAD subroutine.
 
If you look at the P4::AUTOLOAD subroutine, you'll notice that any call to the P4 module that doesn't start with "Fetch", "Parse", "Save", or "Format" is merely translated directly into the P4::Run subroutine, so that any call to the P4 module in the form of:
 
P4::<Cmd>(<parameters&gt;)
 
Is translated as:
 
P4::Run("&lt;cmd>", "<parameters>);
 
So, to force a sync, all you need to do is:
 
$p4->Sync("-f");
 
which is run by the AUTOLOAD command as:
 
$p4->Run("sync", "-f");
 
By using an AUTOLOAD subroutine, the P4.pm module allows you to run any P4 command without the authors having to write an actual subroutine to handle that specific&nbsp;P4 command. For example, you can do things such as
 
$p4->Info();
$p4->Counter("review 1001");
$p4->Where("foo.cpp");
 
 

From: p4perl-bouncesperforce.com [mailto:p4perl-bouncesperforce.com] On Behalf Of mehta suman
Sent: Tuesday, August 01, 2006 10:15 AM
To: p4perlperforce.com
Subject: [p4perl] force sync

where can I get detailed description of p4::Sync command.
Our requirement is to force sync to a particular label. How can do this?
 
Thanks in advance.
Suman

Groups are talking. We´re listening. Check out the handy changes to Yahoo! Groups.


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2˘/min or less.
force sync
user name
2006-08-02 09:59:43
On Wednesday 02 August 2006 06:17, mehta suman wrote:
> Thanks for your prompt response..
>
>   Could you please also tell me what command gets run
at perforce
> commandline when we issue
P4::Run("<cmd>",
"<parameters>); from perl.
>
>   is this converted in to below command?
>   p4 <cmd> <parameters>

Strictly speaking the syntax is (and is documented to be)

	P4::Run( "<cmd>", [
"<parameter>"  ... ] )

and this gets converted into:

	p4 <cmd> [ <parameter> ... ]

> if yes then ,"p4 sync -f
//depot/automation/color/inxIDColor1.js" works at
> command line but
$p4->Run("sync","-f 
> //depot/automation/color/inxIDColor1.js"); fails.

That's because it should be:

  $p4->Run( "sync", "-f",
"//depot/automation/color/inxIDColor1.js" );

Hope that helps,

Tony
_______________________________________________
p4perl mailing list
p4perlperforce.com

http://maillist.perforce.com/mailman/listinfo/p4perl
force sync
user name
2006-08-02 10:27:18
Thanks a lot.. that worked..
 
Suman

Tony Smith <tonysmee.org&gt; wrote:
On Wednesday 02 August 2006 06:17, mehta suman wrote:
>; Thanks for your prompt response..
>
> Could you please also tell me what command gets run at perforce
&gt; commandline when we issue P4::Run("", "); from perl.
>
> is this converted in to below command?
&gt; p4

Strictly speaking the syntax is (and is documented to be)

P4::Run( "", [ "" ... ] )

and this gets converted into:

p4 [ ... ]

> if yes then ,"p4 sync -f //depot/automation/color/inxIDColor1.js" works at
> command line but $p4->Run("sync","-f
> //depot/automation/color/inxIDColor1.js"); fails.

That's because it should be:

$p4-&gt;Run( "sync", "-f", "//depot/automation/color/inxIDColor1.js" );

Hope that helps,

Tony


Want to be your own boss? Learn how on Yahoo! Small Business.
force sync
user name
2006-08-02 14:21:17
P4/Perl doesn't run commands from the command line. Instead, it uses the P4 C++ API. You can think of
 
$p4->Run("sync", "-f //depot/automation/color/inxIDColor1.js);
 
as running the command
 
$ p4 sync -f //depot/automation/color/inxIDColor1.js,
 
but it really doesn't. It's like P4V showing you the resulting p4 command in the log window. But, like the P4/Perl interface, P4V doesn't run the command.
 
This is a bit different from what I wrote earlier on how "$p4->Sync("-f //depot/automation/color/inxIDColor1.js")" really only runs "$p4->Run(sync, "-f //depot/automation/color/inxIDColor1.js"); because of the AUTOLOAD subroutine. P4::Sync() is only an alias of P4::Run("sync"), but still no actual P4 command gets executed.
 
As to why your command isn't working, you should call P4::Errors() and P4::Warnings() right after your call to P4::Sync() or P4::Run(). This will list any warnings or errors generated by the command. There is also a P4::ErrorCount() too.


From: mehta suman [mailto:sumanmehtainyahoo.com]
Sent: Wednesday, August 02, 2006 1:17 AM
To: Weintraub, David; p4perlperforce.com
Subject: RE: [p4perl] force sync

Thanks for your prompt response..
 
Could you please also tell me what command gets run at perforce commandline when we issue P4::Run("&lt;cmd>", "<parameters>); from perl.
 
is this converted in to below command?
p4 <cmd>; <parameters>

if yes then ,"p4 sync -f //depot/automation/color/inxIDColor1.js" works at command line but
$p4->Run("sync","-f  //depot/automation/color/inxIDColor1.js"); fails.
 
thanks again
Suman
"Weintraub, David" <david.weintraubbofasecurities.com>; wrote:
If you looked at the source code of the P4.pm module, you'll notice that the "P4::Sync" subroutine isn't defined there. This isn't uncommon in Perl modules. When you create a Perl module, you can take a shortcut defining all the subroutines (or methods if you prefer&nbsp;object oriented syntax)&nbsp;in that module by creating an AUTOLOAD subroutine. Basically, any undefined call to a subroutine is handled by the AUTOLOAD subroutine.
 
If you look at the P4::AUTOLOAD subroutine, you'll notice that any call to the P4 module that doesn't start with "Fetch", "Parse", "Save", or "Format" is merely translated directly into the P4::Run subroutine, so that any call to the P4 module in the form of:
 
P4::<Cmd>(<parameters&gt;)
 
Is translated as:
 
P4::Run("&lt;cmd>", "<parameters>);
 
So, to force a sync, all you need to do is:
 
$p4->Sync("-f");
 
which is run by the AUTOLOAD command as:
 
$p4->Run("sync", "-f");
 
By using an AUTOLOAD subroutine, the P4.pm module allows you to run any P4 command without the authors having to write an actual subroutine to handle that specific&nbsp;P4 command. For example, you can do things such as
 
$p4->Info();
$p4->Counter("review 1001");
$p4->Where("foo.cpp");
 
 

From: p4perl-bouncesperforce.com [mailto:p4perl-bouncesperforce.com] On Behalf Of mehta suman
Sent: Tuesday, August 01, 2006 10:15 AM
To: p4perlperforce.com
Subject: [p4perl] force sync

where can I get detailed description of p4::Sync command.
Our requirement is to force sync to a particular label. How can do this?
 
Thanks in advance.
Suman

Groups are talking. We´re listening. Check out the handy changes to Yahoo! Groups.


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2˘/min or less.
[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )