You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-dev@maven.apache.org by Wim Deblauwe <wi...@gmail.com> on 2005/11/22 13:49:48 UTC

ScmHelper problem

Hi,

I'm testing with the updated release plugin and ClearCase, but I still get a
problem that pom.xml cannot be edited because it is read-only. I traced the
problem to ScmHelper:

public void edit( File file )
throws ScmException
{
ScmRepository repository = getScmRepository();

EditScmResult result = getScmManager().getProviderByRepository( repository )
.edit( repository, new ScmFileSet( file ) );

checkResult( result );
}

This code gets called ok, but I think you are misusing ScmFileSet. The
constructor with 1 argument is using 'file' as 'basedirectory' and an empty
list of files. As a result, the ClearCaseEditCommand does nothing, because
there are no files in the fileset. Maybe the ScmFileSet needs to throw an
IllegalArgumentException if the given argument is not a directory? Any
thoughts on how the code of ScmHelper is updated best? There are also other
methods that have the same problem.

regards,

Wim

Re: ScmHelper problem

Posted by Emmanuel Venisse <em...@venisse.net>.
strange, signature seems to be correct. verify your classes in clearcase provider jar

Some methods are missing in ClearCaseScmProvider like unedit, add, remove...

Emmanuel

Wim Deblauwe a écrit :
> Hmmm... very strange things going on. I added some debugging and I see 
> the following. The call "getScmManager().getProviderByRepository( 
> repository )" returns an instance of  
> org.apache.maven.scm.provider.clearcase.ClearCaseScmProvider@1db05b2, so 
> that is ok. But when I put debugging in the edit method, this never shows.
> Just for the fun of it, I added a debug line in the edit method of 
> AbstractScmProvider and that one gets called in stead of the overridden 
> one in my subclass! How can that be? The signature is certainly correct, 
> because IntelliJ shows it as overridden method.
> 
> Any ideas?
> 
> regards,
> 
> Wim
> 
> 2005/11/22, Emmanuel Venisse <emmanuel@venisse.net 
> <ma...@venisse.net>>:
> 
>     Can you try whith this :
> 
>          public void edit( File file )
>              throws ScmException
>          {
>              ScmRepository repository = getScmRepository();
> 
>              EditScmResult result =
>     getScmManager().getProviderByRepository( repository )
>                  .edit( repository, new ScmFileSet( new File(
>     workingDirectory ), file ) );
> 
>              checkResult( result );
>          }
> 
>          public void unedit( File file )
>              throws ScmException
>          {
>              ScmRepository repository = getScmRepository();
> 
>              UnEditScmResult result =
>     getScmManager().getProviderByRepository( repository )
>                  .unedit( repository, new ScmFileSet( new File(
>     workingDirectory ), file ) );
> 
>              checkResult( result );
>          }
> 
>     I suppose you'll have the same problem for checkin command.
>     Let me know if it's ok.
> 
>     Emmanuel
> 
>     Wim Deblauwe a écrit :
>      > Hi,
>      >
>      > I'm testing with the updated release plugin and ClearCase, but I
>     still
>      > get a problem that pom.xml cannot be edited because it is
>     read-only. I
>      > traced the problem to ScmHelper:
>      >
>      > public void edit( File file )
>      >         throws ScmException
>      >     {
>      >         ScmRepository repository = getScmRepository();
>      >
>      >         EditScmResult result =
>     getScmManager().getProviderByRepository(
>      > repository )
>      >             .edit( repository, new ScmFileSet( file ) );
>      >
>      >         checkResult( result );
>      >     }
>      >
>      > This code gets called ok, but I think you are misusing
>     ScmFileSet. The
>      > constructor with 1 argument is using 'file' as 'basedirectory' and an
>      > empty list of files. As a result, the ClearCaseEditCommand does
>     nothing,
>      > because there are no files in the fileset. Maybe the ScmFileSet
>     needs to
>      > throw an IllegalArgumentException if the given argument is not a
>      > directory? Any thoughts on how the code of ScmHelper is updated
>     best?
>      > There are also other methods that have the same problem.
>      >
>      > regards,
>      >
>      > Wim
> 
> 


Re: ScmHelper problem

Posted by Wim Deblauwe <wi...@gmail.com>.
Hmmm... very strange things going on. I added some debugging and I see the
following. The call "getScmManager().getProviderByRepository( repository )"
returns an instance of
org.apache.maven.scm.provider.clearcase.ClearCaseScmProvider@1db05b2, so
that is ok. But when I put debugging in the edit method, this never shows.
Just for the fun of it, I added a debug line in the edit method of
AbstractScmProvider and that one gets called in stead of the overridden one
in my subclass! How can that be? The signature is certainly correct, because
IntelliJ shows it as overridden method.

Any ideas?

regards,

Wim

2005/11/22, Emmanuel Venisse <em...@venisse.net>:
>
> Can you try whith this :
>
> public void edit( File file )
> throws ScmException
> {
> ScmRepository repository = getScmRepository();
>
> EditScmResult result = getScmManager().getProviderByRepository( repository
> )
> .edit( repository, new ScmFileSet( new File( workingDirectory ), file ) );
>
> checkResult( result );
> }
>
> public void unedit( File file )
> throws ScmException
> {
> ScmRepository repository = getScmRepository();
>
> UnEditScmResult result = getScmManager().getProviderByRepository(
> repository )
> .unedit( repository, new ScmFileSet( new File( workingDirectory ), file )
> );
>
> checkResult( result );
> }
>
> I suppose you'll have the same problem for checkin command.
> Let me know if it's ok.
>
> Emmanuel
>
> Wim Deblauwe a écrit :
> > Hi,
> >
> > I'm testing with the updated release plugin and ClearCase, but I still
> > get a problem that pom.xml cannot be edited because it is read-only. I
> > traced the problem to ScmHelper:
> >
> > public void edit( File file )
> > throws ScmException
> > {
> > ScmRepository repository = getScmRepository();
> >
> > EditScmResult result = getScmManager().getProviderByRepository(
> > repository )
> > .edit( repository, new ScmFileSet( file ) );
> >
> > checkResult( result );
> > }
> >
> > This code gets called ok, but I think you are misusing ScmFileSet. The
> > constructor with 1 argument is using 'file' as 'basedirectory' and an
> > empty list of files. As a result, the ClearCaseEditCommand does nothing,
> > because there are no files in the fileset. Maybe the ScmFileSet needs to
> > throw an IllegalArgumentException if the given argument is not a
> > directory? Any thoughts on how the code of ScmHelper is updated best?
> > There are also other methods that have the same problem.
> >
> > regards,
> >
> > Wim
>
>

Re: ScmHelper problem

Posted by Emmanuel Venisse <em...@venisse.net>.
Can you try whith this :

     public void edit( File file )
         throws ScmException
     {
         ScmRepository repository = getScmRepository();

         EditScmResult result = getScmManager().getProviderByRepository( repository )
             .edit( repository, new ScmFileSet( new File( workingDirectory ), file ) );

         checkResult( result );
     }

     public void unedit( File file )
         throws ScmException
     {
         ScmRepository repository = getScmRepository();

         UnEditScmResult result = getScmManager().getProviderByRepository( repository )
             .unedit( repository, new ScmFileSet( new File( workingDirectory ), file ) );

         checkResult( result );
     }

I suppose you'll have the same problem for checkin command.
Let me know if it's ok.

Emmanuel

Wim Deblauwe a écrit :
> Hi,
> 
> I'm testing with the updated release plugin and ClearCase, but I still 
> get a problem that pom.xml cannot be edited because it is read-only. I 
> traced the problem to ScmHelper:
> 
> public void edit( File file )
>         throws ScmException
>     {
>         ScmRepository repository = getScmRepository();
> 
>         EditScmResult result = getScmManager().getProviderByRepository( 
> repository )
>             .edit( repository, new ScmFileSet( file ) );
> 
>         checkResult( result );
>     }
> 
> This code gets called ok, but I think you are misusing ScmFileSet. The 
> constructor with 1 argument is using 'file' as 'basedirectory' and an 
> empty list of files. As a result, the ClearCaseEditCommand does nothing, 
> because there are no files in the fileset. Maybe the ScmFileSet needs to 
> throw an IllegalArgumentException if the given argument is not a 
> directory? Any thoughts on how the code of ScmHelper is updated best? 
> There are also other methods that have the same problem.
> 
> regards,
> 
> Wim