threads / discuss / 16568

git-p4 submit, Can't clobber writable file

Subject: git-p4 submit, Can't clobber writable file

## tl;dr

8 messages between Dec 2, 2008 and Dec 3, 2008.

replies: 7people: 4as markdown or json

Gary Yang· Dec 2, 2008, 22:30 UTC · lore
I followed the instructions at http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
But, I am not able to git-p4 submit. Any idea?

git-p4 clone //build/scripts build_scripts cd build_scripts vi foo.h git commit foo.h git-p4 rebase git-p4 submit

  from sets import Set;
Perforce checkout for depot path //build/scripts/ located at /home/gyang/workspace/build_scripts/
Syncronizing p4 checkout...
//build/scripts/foo.h#1 - added as /home/gyang/workspace/build_scripts/foo.h
Can't clobber writable file /home/gyang/workspace/build_scripts/foo.h
//build/scripts/foo.c#1 - added as /home/gyang/workspace/build_scripts/foo.c
Can't clobber writable file /user/home/gyang/workspace/build_scripts/foo.c
......
command failed: p4 sync ...
Thanks.
      
Reece Dunn· Dec 2, 2008, 23:51 UTC · re: Gary Yang · lore

Re: git-p4 submit, Can't clobber writable file

2008/12/2 Gary Yang <garyyang6@yahoo.com>:
Show 15 quoted lines
>
> I followed the instructions at http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
>
> But, I am not able to git-p4 submit. Any idea?
>
> git-p4 clone //build/scripts build_scripts
> cd build_scripts
> vi foo.h
> git commit foo.h
> git-p4 rebase
> git-p4 submit
>
>  from sets import Set;
> Perforce checkout for depot path //build/scripts/ located at /home/gyang/workspace/build_scripts/
> Syncronizing p4 checkout...

This will be running a `p4 sync ...` command to ensure that the files are up-to-date.

Show 6 quoted lines
> //build/scripts/foo.h#1 - added as /home/gyang/workspace/build_scripts/foo.h
> Can't clobber writable file /home/gyang/workspace/build_scripts/foo.h
> //build/scripts/foo.c#1 - added as /home/gyang/workspace/build_scripts/foo.c
> Can't clobber writable file /user/home/gyang/workspace/build_scripts/foo.c
> ......
> command failed: p4 sync ...

Perforce will mark files as readonly when it does a checkout. When you use `p4 edit` to say you have made changes to the file, Perforce removes the readonly bit.

What is happening here is that the sync (checkout) command is trying to write foo.h/c to your build_scripts directory, but because they already exist there *and* are not readonly, Perforce is producing that error as it does not want to overwrite any files that have changed locally.

Not sure what is happening on the git-p4 side, though.
- Reece
Gary Yang· Dec 3, 2008, 00:14 UTC · re: Reece Dunn · lore

Re: git-p4 submit, Can't clobber writable file

Reece,
I understand your explanation. But, git-p4 submit does not work for me. Are you able to re-produce the problem?
Thanks,
Gary
--- On Tue, 12/2/08, Reece Dunn <msclrhd@googlemail.com> wrote:
Show 58 quoted lines
> From: Reece Dunn <msclrhd@googlemail.com>
> Subject: Re: git-p4 submit, Can't clobber writable file
> To: garyyang6@yahoo.com
> Cc: git@vger.kernel.org
> Date: Tuesday, December 2, 2008, 3:51 PM
> 2008/12/2 Gary Yang <garyyang6@yahoo.com>:
> >
> > I followed the instructions at
> http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> >
> > But, I am not able to git-p4 submit. Any idea?
> >
> > git-p4 clone //build/scripts build_scripts
> > cd build_scripts
> > vi foo.h
> > git commit foo.h
> > git-p4 rebase
> > git-p4 submit
> >
> >  from sets import Set;
> > Perforce checkout for depot path //build/scripts/
> located at /home/gyang/workspace/build_scripts/
> > Syncronizing p4 checkout...
> 
> This will be running a `p4 sync ...` command to ensure that
> the files
> are up-to-date.
> 
> > //build/scripts/foo.h#1 - added as
> /home/gyang/workspace/build_scripts/foo.h
> > Can't clobber writable file
> /home/gyang/workspace/build_scripts/foo.h
> > //build/scripts/foo.c#1 - added as
> /home/gyang/workspace/build_scripts/foo.c
> > Can't clobber writable file
> /user/home/gyang/workspace/build_scripts/foo.c
> > ......
> > command failed: p4 sync ...
> 
> Perforce will mark files as readonly when it does a
> checkout. When you
> use `p4 edit` to say you have made changes to the file,
> Perforce
> removes the readonly bit.
> 
> What is happening here is that the sync (checkout) command
> is trying
> to write foo.h/c to your build_scripts directory, but
> because they
> already exist there *and* are not readonly, Perforce is
> producing that
> error as it does not want to overwrite any files that have
> changed
> locally.
> 
> Not sure what is happening on the git-p4 side, though.
> 
> - Reece
Jing Xue· Dec 3, 2008, 03:07 UTC · re: Gary Yang · lore

Re: git-p4 submit, Can't clobber writable file

On Tue, Dec 02, 2008 at 02:30:51PM -0800, Gary Yang wrote:
Show 21 quoted lines
> 
> I followed the instructions at http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> 
> But, I am not able to git-p4 submit. Any idea?
> 
> git-p4 clone //build/scripts build_scripts
> cd build_scripts
> vi foo.h
> git commit foo.h
> git-p4 rebase
> git-p4 submit
> 
>   from sets import Set;
> Perforce checkout for depot path //build/scripts/ located at /home/gyang/workspace/build_scripts/
> Syncronizing p4 checkout...
> //build/scripts/foo.h#1 - added as /home/gyang/workspace/build_scripts/foo.h
> Can't clobber writable file /home/gyang/workspace/build_scripts/foo.h
> //build/scripts/foo.c#1 - added as /home/gyang/workspace/build_scripts/foo.c
> Can't clobber writable file /user/home/gyang/workspace/build_scripts/foo.c
> ......
> command failed: p4 sync ...

You might want to clone to a git working dir different than the p4 working dir.

For instance, if your p4 workspace has the working dir set to build_scripts/, try 'git p4 clone //build/scripts build_scripts.git'.

You would then normally work under build_scripts.git/. build_scripts/ would only be used by git-p4 at submission time.

Cheers.
-- 
Jing Xue
Gary Yang· Dec 3, 2008, 06:04 UTC · re: Jing Xue · lore

Re: git-p4 submit, Can't clobber writable file

So, I have to keep two copies of source tree at my home directory. One is for Perforce build_scripts workspace, another is for Git build_scripts.git. I normally work at build_scripts.git. But, when I need to submit changes to Perforce, I have to copy changed code from build_scripts.git to build_scripts. Then, p4 submit code into Perforce. Is this the only way of using git-p4?
Note: I cannot use git-p4 submit at build_scripts. It claims "Cannot clobber writable file". Is it a bug of git-p4 or the instruction is not correct?
--- On Tue, 12/2/08, Jing Xue <jingxue@digizenstudio.com> wrote:
Show 50 quoted lines
> From: Jing Xue <jingxue@digizenstudio.com>
> Subject: Re: git-p4 submit, Can't clobber writable file
> To: "Gary Yang" <garyyang6@yahoo.com>
> Cc: git@vger.kernel.org
> Date: Tuesday, December 2, 2008, 7:07 PM
> On Tue, Dec 02, 2008 at 02:30:51PM -0800, Gary Yang wrote:
> > 
> > I followed the instructions at
> http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> > 
> > But, I am not able to git-p4 submit. Any idea?
> > 
> > git-p4 clone //build/scripts build_scripts
> > cd build_scripts
> > vi foo.h
> > git commit foo.h
> > git-p4 rebase
> > git-p4 submit
> > 
> >   from sets import Set;
> > Perforce checkout for depot path //build/scripts/
> located at /home/gyang/workspace/build_scripts/
> > Syncronizing p4 checkout...
> > //build/scripts/foo.h#1 - added as
> /home/gyang/workspace/build_scripts/foo.h
> > Can't clobber writable file
> /home/gyang/workspace/build_scripts/foo.h
> > //build/scripts/foo.c#1 - added as
> /home/gyang/workspace/build_scripts/foo.c
> > Can't clobber writable file
> /user/home/gyang/workspace/build_scripts/foo.c
> > ......
> > command failed: p4 sync ...
> 
> You might want to clone to a git working dir different than
> the p4
> working dir.
> 
> For instance, if your p4 workspace has the working dir set
> to
> build_scripts/, try 'git p4 clone //build/scripts
> build_scripts.git'.
> 
> You would then normally work under build_scripts.git/.
> build_scripts/
> would only be used by git-p4 at submission time.
> 
> Cheers.
> -- 
> Jing Xue
Arafangion· Dec 3, 2008, 11:07 UTC · re: Gary Yang · lore

Re: git-p4 submit, Can't clobber writable file

I would argue that's a bug with git-p4, however that is a warning given by perforce, thus, you should be able to work around it by changing the clientspec, change the clientspec so that it will clobber such files, you will need to refer to the perforce docs for info about that.

On Tue, 2008-12-02 at 22:04 -0800, Gary Yang wrote:
Show 63 quoted lines
> So, I have to keep two copies of source tree at my home directory. One is for Perforce build_scripts workspace, another is for Git build_scripts.git. I normally work at build_scripts.git. But, when I need to submit changes to Perforce, I have to copy changed code from build_scripts.git to build_scripts. Then, p4 submit code into Perforce. Is this the only way of using git-p4?
> Note: I cannot use git-p4 submit at build_scripts. It claims "Cannot clobber writable file". Is it a bug of git-p4 or the instruction is not correct?
> 
> 
> --- On Tue, 12/2/08, Jing Xue <jingxue@digizenstudio.com> wrote:
> 
> > From: Jing Xue <jingxue@digizenstudio.com>
> > Subject: Re: git-p4 submit, Can't clobber writable file
> > To: "Gary Yang" <garyyang6@yahoo.com>
> > Cc: git@vger.kernel.org
> > Date: Tuesday, December 2, 2008, 7:07 PM
> > On Tue, Dec 02, 2008 at 02:30:51PM -0800, Gary Yang wrote:
> > > 
> > > I followed the instructions at
> > http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> > > 
> > > But, I am not able to git-p4 submit. Any idea?
> > > 
> > > git-p4 clone //build/scripts build_scripts
> > > cd build_scripts
> > > vi foo.h
> > > git commit foo.h
> > > git-p4 rebase
> > > git-p4 submit
> > > 
> > >   from sets import Set;
> > > Perforce checkout for depot path //build/scripts/
> > located at /home/gyang/workspace/build_scripts/
> > > Syncronizing p4 checkout...
> > > //build/scripts/foo.h#1 - added as
> > /home/gyang/workspace/build_scripts/foo.h
> > > Can't clobber writable file
> > /home/gyang/workspace/build_scripts/foo.h
> > > //build/scripts/foo.c#1 - added as
> > /home/gyang/workspace/build_scripts/foo.c
> > > Can't clobber writable file
> > /user/home/gyang/workspace/build_scripts/foo.c
> > > ......
> > > command failed: p4 sync ...
> > 
> > You might want to clone to a git working dir different than
> > the p4
> > working dir.
> > 
> > For instance, if your p4 workspace has the working dir set
> > to
> > build_scripts/, try 'git p4 clone //build/scripts
> > build_scripts.git'.
> > 
> > You would then normally work under build_scripts.git/.
> > build_scripts/
> > would only be used by git-p4 at submission time.
> > 
> > Cheers.
> > -- 
> > Jing Xue
> 
> 
>       
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gary Yang· Dec 3, 2008, 19:06 UTC · re: Arafangion · lore

Re: git-p4 submit, Can't clobber writable file

Arafangion,
I got email from Jing and I solved the problem. The doc should clearly state that we need a separated P4 working dir in order to make git p4 submit work. Many thanks to Jing.
Gary
--- On Wed, 12/3/08, Arafangion <thestar@fussycoder.id.au> wrote:
Show 106 quoted lines
> From: Arafangion <thestar@fussycoder.id.au>
> Subject: Re: git-p4 submit, Can't clobber writable file
> To: garyyang6@yahoo.com
> Cc: "Jing Xue" <jingxue@digizenstudio.com>, git@vger.kernel.org
> Date: Wednesday, December 3, 2008, 3:07 AM
> I would argue that's a bug with git-p4, however that is
> a warning given
> by perforce, thus, you should be able to work around it by
> changing the
> clientspec, change the clientspec so that it will clobber
> such files,
> you will need to refer to the perforce docs for info about
> that.
> 
> On Tue, 2008-12-02 at 22:04 -0800, Gary Yang wrote:
> > So, I have to keep two copies of source tree at my
> home directory. One is for Perforce build_scripts workspace,
> another is for Git build_scripts.git. I normally work at
> build_scripts.git. But, when I need to submit changes to
> Perforce, I have to copy changed code from build_scripts.git
> to build_scripts. Then, p4 submit code into Perforce. Is
> this the only way of using git-p4?
> > Note: I cannot use git-p4 submit at build_scripts. It
> claims "Cannot clobber writable file". Is it a bug
> of git-p4 or the instruction is not correct?
> > 
> > 
> > --- On Tue, 12/2/08, Jing Xue
> <jingxue@digizenstudio.com> wrote:
> > 
> > > From: Jing Xue <jingxue@digizenstudio.com>
> > > Subject: Re: git-p4 submit, Can't clobber
> writable file
> > > To: "Gary Yang"
> <garyyang6@yahoo.com>
> > > Cc: git@vger.kernel.org
> > > Date: Tuesday, December 2, 2008, 7:07 PM
> > > On Tue, Dec 02, 2008 at 02:30:51PM -0800, Gary
> Yang wrote:
> > > > 
> > > > I followed the instructions at
> > >
> http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> > > > 
> > > > But, I am not able to git-p4 submit. Any
> idea?
> > > > 
> > > > git-p4 clone //build/scripts build_scripts
> > > > cd build_scripts
> > > > vi foo.h
> > > > git commit foo.h
> > > > git-p4 rebase
> > > > git-p4 submit
> > > > 
> > > >   from sets import Set;
> > > > Perforce checkout for depot path
> //build/scripts/
> > > located at /home/gyang/workspace/build_scripts/
> > > > Syncronizing p4 checkout...
> > > > //build/scripts/foo.h#1 - added as
> > > /home/gyang/workspace/build_scripts/foo.h
> > > > Can't clobber writable file
> > > /home/gyang/workspace/build_scripts/foo.h
> > > > //build/scripts/foo.c#1 - added as
> > > /home/gyang/workspace/build_scripts/foo.c
> > > > Can't clobber writable file
> > > /user/home/gyang/workspace/build_scripts/foo.c
> > > > ......
> > > > command failed: p4 sync ...
> > > 
> > > You might want to clone to a git working dir
> different than
> > > the p4
> > > working dir.
> > > 
> > > For instance, if your p4 workspace has the
> working dir set
> > > to
> > > build_scripts/, try 'git p4 clone
> //build/scripts
> > > build_scripts.git'.
> > > 
> > > You would then normally work under
> build_scripts.git/.
> > > build_scripts/
> > > would only be used by git-p4 at submission time.
> > > 
> > > Cheers.
> > > -- 
> > > Jing Xue
> > 
> > 
> >       
> > --
> > To unsubscribe from this list: send the line
> "unsubscribe git" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at 
> http://vger.kernel.org/majordomo-info.html
> 
> --
> To unsubscribe from this list: send the line
> "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at 
> http://vger.kernel.org/majordomo-info.html
Jing Xue· Dec 3, 2008, 14:24 UTC · re: Gary Yang · lore

Re: git-p4 submit, Can't clobber writable file

(Just a friendly reminder - I believe the convention on this list is "no top-post.")

On Tue, Dec 02, 2008 at 10:04:20PM -0800, Gary Yang wrote:
Show 21 quoted lines
> 
> --- On Tue, 12/2/08, Jing Xue <jingxue@digizenstudio.com> wrote:
>
> > You might want to clone to a git working dir different than
> > the p4
> > working dir.
> > 
> > For instance, if your p4 workspace has the working dir set
> > to
> > build_scripts/, try 'git p4 clone //build/scripts
> > build_scripts.git'.
> > 
> > You would then normally work under build_scripts.git/.
> > build_scripts/
> > would only be used by git-p4 at submission time.
>
> So, I have to keep two copies of source tree at my home directory. One
> is for Perforce build_scripts workspace, another is for Git
> build_scripts.git. I normally work at build_scripts.git. But, when I
> need to submit changes to Perforce, I have to copy changed code from
> build_scripts.git to build_scripts.

You don't have to do that, not manually. That's git-p4's job. When you do 'git p4 submit', it basically:

1. calls 'p4 sync' in the p4 working dir,
2. generates patches from p4/master..HEAD,
3. for each of the patches, applies it in the p4 working dir, and 'p4
submit' it as one changelist.
> Then, p4 submit code into
> Perforce. Is this the only way of using git-p4?  Note: I cannot use
> git-p4 submit at build_scripts. It claims "Cannot clobber writable
> file". Is it a bug of git-p4 or the instruction is not correct?

Git-p4.txt does mention this (although briefly) in the "Submitting" section:

"git-p4 has support for submitting changes from a git repository back to the Perforce depot. This requires a Perforce checkout separate from your git repository..."

Cheers.
-- 
Jing Xue

← back to recent threads