[NAntC-Dev] Bug in Perforce Nant tasks

2006-09-20 Thread Weintraub, David



There is a bug in 
the changelist parameter for all the Perforce nant tasks that take the 
changelist parameter.
 
If  the 
changelist parameter's value is longer than 31 characters, each task will create 
a new changelist even though you are using the same changelist parameter value 
with each one.
 
The bug is in 
"GetChangelistNumber(string User, string Client, string ChangeList)" function 
(line #76) in Perforce.cs. If this function cannot match the changelist 
description given in the changelist parameter in the various P4 nant tasks, the 
various Perforce nant tasks will create a new changelist.
 
The bug has to do 
with the way that the "p4 changes -u  -s pending" command produces 
output. This command only lists the first 31 characters of the changelist 
description, so long changelists will never match the changelist parameter 
value passed to this function.
 
There are several possible 
solutions:
 
* Fail the CreateChangeList function if the 
ChangeList parameter passed is longer than 31 characters. This will have to be 
documented.
 
* Have GetChangelistNumber and 
CreateChangeList functions truncate the ChangeList parameter to 31 characters. 
This will guarantee a match if the changelist already exists. The question is 
whether you're better off truncating the front, end, or middle of this 
parameter, and I guess revolves around whether in a long description whether the 
beginning or end will most likely be unique. I had a Pascal compiler that 
truncated extra long variable names in the middle on the assumption that in very 
long names, the first characters and last characters are likely to be unique, 
and the middle characters are likely to be duplicates.
 
* Use either "p4 -ztag changes -u 
 -s pending" or "p4 changes -u  -s pending -L" for 
matching the description to the changelist number in GetChangelistNumber 
function. These two commands won't truncate the description of the changelist, 
but you'll have to change the logic of this function since both of these 
commands list the changelist description on a separate line from the changelist 
number.
 
* Rewrite all of the Perforce tasks to use 
Perforce's P4COM interface that directly calls the P4API instead of depending 
upon the command line command outputs. We can include the P4COM as part of the 
distribution. There is a version for both Windows and Linux, but it isn't open 
source. That might affect the GNU 
license.
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
NAntContrib-Developer mailing list
NAntContrib-Developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nantcontrib-developer


[NAntC-Dev] Something is very strange with p4 Nant tasks...

2006-09-20 Thread Weintraub, David



Again, I'm 
not a C# developer, but the source code looks right. It's using the same 
routines for creating a changelist in p4change, p4add, p4edit, p4reopen, etc. 
However, when I do a p4change, it pops up a notepad editor when it shouldn't. In 
p4add, p4edit, and p4reopen, if the changelist doesn't exist, it creates it. 
Each of these routines can find the correct change list. However, if I do a the 
task "p4change" with the parameter of  delete="true", it does not put the 
changelist number at the end of the command.
 
I have a hard time 
believing that the source I am looking at is the source that was used to compile 
the tasks. Is it possible that a complete build is not getting done. That older 
DLLs are being used and not rebuilt?
 
Anyone who knows C# 
and .NET want to help with this one? I know Perforce and can help out with that 
end, but I don't know C#. I've tried rebuilding the source myself, but I am 
missing some external dependencies.
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
NAntContrib-Developer mailing list
NAntContrib-Developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nantcontrib-developer


Re: [NAntC-Dev] Bugs in Perforce Nant Tasks

2006-09-20 Thread Weintraub, David
I am NOT a C# developer, or even a developer. In fact, I don't even know
C#. I hadn't written a serious lick of code in over a dozen years.

However, I looked over the code, and wonder if this stuff had been
built.

The P4Changes.cs module looks like the module that the p4change task
calls. If you say



It looks like it goes to line 101 and calls the "protected string
getSpecificCommandArguments()". In this member function, it appears to
be building the p4 command to execute from the command line. It adds to
the arguments the word "change ", then it adds a "-d ", then it runs
"Perforce.GetChangelistNumber(User, Client, Changelist)".

"Perforce.GetChangelistNumber(User, Client, Changelist)" is in
Perfoce.cs. It runs the "p4 changes -s  -s  command to
get a list of changelists for that user. It then parses the output of
this command to find the string specified in "changelist", and then
returns the corresponding changelist number. This changelist is added to
the "change -d " argument string. So, the whole string looks like this:
"change -d " which is the correct format of the P4 command.

Even more confusing, P4Add, P4Submit, and P4Reopen also seem to use the
same routine to find and create the changelist. I have no idea why

 

doesn't work as expected. I am not a C# developer, but the general
technique looks like it should be working.

I'm going to try recompiling this and see what happens.

-Original Message-
From: Gert Driesen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 20, 2006 2:56 AM
To: Weintraub, David; nantcontrib-developer@lists.sourceforge.net
Subject: Re: [NAntC-Dev] Bugs in Perforce Nant Tasks

David,

I don't recall who originally contributed the perforce tasks (and I
don't have the sources available right now to check).

Problem is that I don't have a perforce repository available to test
against.

Could you review the source code of these tasks, and perhaps provide
patches for it ?

I'll contact the orignal author and ask him to review your changes.

What do you think?

Gert

- Original Message -
From: "Weintraub, David" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, September 19, 2006 11:54 PM
Subject: [NAntC-Dev] Bugs in Perforce Nant Tasks


>I am having trouble with some of the Nant Perforce tasks.
>
> First problem is with "p4change". I am doing this:
>
>  
>client="${p4Client}"
>  port="${p4Port}"
>  user="${p4User}"
>  verbose="${isDebug}"/>
>
> This is attempting to bring up a text file for me to edit which it
> shouldn't be doing in the middle of a nant build.
>
> ===
> Here's the other problem.
>
> I manually create a changelist, and put in my description
> "test_test_test". Perforce numbers this changelist as 1001:
>
> Now if I do this:
>
>   
>  view="${assemblyInfoFile}"
>   changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>   user="${p4User}"
>   verbose="${isDebug}"
>   failonerror="false"/>
>
> The file ${assemblyInfoFile} is checked out against the changelist
1001
> and not the default changelist.
>
> And, if I do this:
>
>   
>  changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>   user="${p4User}"
>   verbose="${isDebug}"/>
>
> The submit is done against changelist 1001 and not the default
> changelist.
>
> However, if I do this:
>
>   
>  changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>   user="${p4User}"
>   verbose="${isDebug}"/>
>
> I get the following error:
>
> [p4revert] Usage: revert [ -a -n -k -c changelist# ] files...
> [p4revert] Missing/wrong number of arguments.
>
> Even worse, If I do this:
>
> 
>   
>  view="${assemblyInfoFile}"
>   changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>   user="${p4User}"
>   verbose="${isDebug}"
>   failonerror="false"/>
>
> Nant creates a new changelist with a description of "1001" instead of
> using Changelist #1001! At least this:
>
>   
>  ch

Re: [NAntC-Dev] Bugs in Perforce Nant Tasks

2006-09-20 Thread Weintraub, David
I'm not a developer, and I really don't know much about .NET development
(I am a build/release engineer), but I'll see what I can about the
source. It appears that the P4 tasks exec the actual Perforce commands
instead of using the C++ based Perforce API and the P4COM project which
provides a C# (.NET) interface. (More information on the Perforce API
can be found on
<http://public.perforce.com/guest/robert_cowham/perforce/API/p4com/main/
index.html>).

You can download a fully working copy of Perforce from www.perforce.com
and use it as long as you have no more than two users and two "clients".
That really should be more than sufficient for testing Nant Perforce
tasks. Perforce is also rather generous with licenses, and will give
free licenses for Open Source work like Nant.

I use both Perforce and Subversion at home for what development I do
(webpage stuff in JavaScript and PHP, Perl scripts, Joomla modules,
etc.).

-Original Message-
From: Gert Driesen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 20, 2006 2:56 AM
To: Weintraub, David; nantcontrib-developer@lists.sourceforge.net
Subject: Re: [NAntC-Dev] Bugs in Perforce Nant Tasks

David,

I don't recall who originally contributed the perforce tasks (and I
don't have the sources available right now to check).

Problem is that I don't have a perforce repository available to test
against.

Could you review the source code of these tasks, and perhaps provide
patches for it ?

I'll contact the orignal author and ask him to review your changes.

What do you think?

Gert

- Original Message -
From: "Weintraub, David" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, September 19, 2006 11:54 PM
Subject: [NAntC-Dev] Bugs in Perforce Nant Tasks


>I am having trouble with some of the Nant Perforce tasks.
>
> First problem is with "p4change". I am doing this:
>
>  
>client="${p4Client}"
>  port="${p4Port}"
>  user="${p4User}"
>  verbose="${isDebug}"/>
>
> This is attempting to bring up a text file for me to edit which it
> shouldn't be doing in the middle of a nant build.
>
> ===
> Here's the other problem.
>
> I manually create a changelist, and put in my description
> "test_test_test". Perforce numbers this changelist as 1001:
>
> Now if I do this:
>
>   
>  view="${assemblyInfoFile}"
>   changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>   user="${p4User}"
>   verbose="${isDebug}"
>   failonerror="false"/>
>
> The file ${assemblyInfoFile} is checked out against the changelist
1001
> and not the default changelist.
>
> And, if I do this:
>
>   
>  changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>   user="${p4User}"
>   verbose="${isDebug}"/>
>
> The submit is done against changelist 1001 and not the default
> changelist.
>
> However, if I do this:
>
>   
>  changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>   user="${p4User}"
>   verbose="${isDebug}"/>
>
> I get the following error:
>
> [p4revert] Usage: revert [ -a -n -k -c changelist# ] files...
> [p4revert] Missing/wrong number of arguments.
>
> Even worse, If I do this:
>
> 
>   
>  view="${assemblyInfoFile}"
>   changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>   user="${p4User}"
>   verbose="${isDebug}"
>   failonerror="false"/>
>
> Nant creates a new changelist with a description of "1001" instead of
> using Changelist #1001! At least this:
>
>   
>  changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>   user="${p4User}"
>   verbose="${isDebug}"/>
>
> Is using the same changelist as my original p4edit task (even its not
> the one I specified).
>
> However, this:
>
>   
>  changelist="${p4Changelist}"
>   client="${p4Client}"
>   port="${p4Port}"
>  

[NAntC-Dev] Bugs in Perforce Nant Tasks

2006-09-19 Thread Weintraub, David
I am having trouble with some of the Nant Perforce tasks.
 
First problem is with "p4change". I am doing this:

   
  

This is attempting to bring up a text file for me to edit which it
shouldn't be doing in the middle of a nant build.

===
Here's the other problem.

I manually create a changelist, and put in my description
"test_test_test". Perforce numbers this changelist as 1001:

Now if I do this:

   
   

The file ${assemblyInfoFile} is checked out against the changelist 1001
and not the default changelist.

And, if I do this:

   
   
 
The submit is done against changelist 1001 and not the default
changelist.

However, if I do this:

   
   

I get the following error:

 [p4revert] Usage: revert [ -a -n -k -c changelist# ] files...
 [p4revert] Missing/wrong number of arguments.

Even worse, If I do this:


   
   

Nant creates a new changelist with a description of "1001" instead of
using Changelist #1001! At least this:

   
   

Is using the same changelist as my original p4edit task (even its not
the one I specified).

However, this:

   
   

Still gives me the following error:

 [p4revert] Usage: revert [ -a -n -k -c changelist# ] files...
 [p4revert] Missing/wrong number of arguments.

I really don't mind if p4submit, p4edit, and other Perforce Nant tasks
use the Changelist description and not the changelist number. It is also
rather convenient that these tasks seem to create the changelist if one
doesn't already exist with that description. However, the p4revert task
is out of sync with the rest of the Perforce tasks, and the p4change
task is pretty useless. Also, the "p4label" task doesn't work as
documented. In the "p4label" task, you must have a "view" parameter
while the documentation says it is optional.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
NAntContrib-Developer mailing list
NAntContrib-Developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nantcontrib-developer