git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Green <Kevin.T.Green@morganstanley.com>
To: Simon Hausmann <simon@lst.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-p4: Fix race between p4_edit and p4_change
Date: Thu, 3 Apr 2008 14:45:38 -0400	[thread overview]
Message-ID: <20080403184537.GH22542@morganstanley.com> (raw)
In-Reply-To: <200804032032.39860.simon@lst.de>

On 04/03/08 14:32:32, Simon Hausmann wrote:
> On Wednesday 02 April 2008 00:28:56 Kevin Green wrote:
> > Hi,
> >
> > Ran into a nasty race today with git-p4.  The changelist Files: section was
> > showing up empty and it turned out to be a race between the p4_edit and
> > p4_change -o, e.g.
> >
> > $ p4 edit $file && p4 change -o
> >
> > will show no files in the Files: section.
> >
> > I attach a patch after my .sig as a suggested fix.  It simply loops over
> > the p4_changes -o as long as we're not finding any files (and we always
> > should since we just did a p4_edit!); sleeping for 3 secs in between to
> > allow Perforce to catch up with itself.
> 
> I don't mind the workaround in general as I agree this race is a bit nasy, but 
> shouldn't the sleep only happen if we didn't find any files? Right now even 
> if the server reacted immediately we still sleep for three seconds.
> 

Oops.  You're absolutely correct and that's not what I intended...  (darn
Python whitespace ;)

I didn't catch that logic error in my testing because I was expecting it to
sleep anyhow...

> 
> Last but not least we could of course also generate the entire Files: section 
> ourselves, using 'p4 change -o' just to get the rest of the template right.
> 
> I almost prefer the last approach, since we know the base depot path and the 
> relative paths of all edited/added files.
> 
> What do you think?
> 

Thank you...  That's the right approach.  Stop as soon as we get to the Files:
section and then just add in the depot + filepath string for each change...


--Kevin

  reply	other threads:[~2008-04-03 18:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-01 22:28 [PATCH] git-p4: Fix race between p4_edit and p4_change Kevin Green
2008-04-03 18:32 ` Simon Hausmann
2008-04-03 18:45   ` Kevin Green [this message]
2008-04-03 19:51     ` [PATCH] git-p4: Work around " Kevin Green
2008-04-11 16:27       ` Kevin Green

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080403184537.GH22542@morganstanley.com \
    --to=kevin.t.green@morganstanley.com \
    --cc=git@vger.kernel.org \
    --cc=simon@lst.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).