[petsc-dev] hg problem

Satish Balay balay at mcs.anl.gov
Wed Aug 24 21:09:25 CDT 2011


On Wed, 24 Aug 2011, Satish Balay wrote:

> you were perhaps in a middle of a merge. To check that - you would do:
> 
> hg parent
> 
> Here 'hg status; hg diff' doesn't really help with figuring out things.

I should have said: When in the merge mode - 'hg status/diff' should
not be interpreted as 'my changes'. It usually correspoinds to the
remote changes that are being merged.

hg status/diff is always wrt 'parent'.

Explanation:

With the workflow "edit; commit; pull; merge; commit" - the following
happens:

1 edit: When you change files 'hg status/diff' would show your edits
wrt your start point. [aka parent]

2. commit: A new commit is made. This rev is now both the parent and
tip [of the working files].

[parent/tip]
changeset:   20045:4bf480f9a778
user:        Mark F. Adams <mark.adams at columbia.edu>

3. pull: now you get new changes from the remote repo. The head of
these new changesets becomes the tip, but parent remains the same as
above. [Now you have 2 heads - tip, parent]

[tip]
changeset:   20041:10ecfa0551da
user:        Lisandro Dalcin <dalcinl at gmail.com>
[parent]
changeset:   20045:4bf480f9a778
user:        Mark F. Adams <mark.adams at columbia.edu>

3. merge: Now the changes from tip [which you pulled] get applied to
the working copy [i.e working copy now corresopnds to merging of your
changes with the remote changes]. And both heads are marked as parent
in this 'merge mode'.

[parent]
changeset:   20045:4bf480f9a778
user:        Mark F. Adams <mark.adams at columbia.edu>
changeset:   20041:10ecfa0551da
user:        Lisandro Dalcin <dalcinl at gmail.com>

4. Now if you do 'hg status/diff' - it shows the changes in the
working files wrt the first parent. i.e changes wrt 20045.  But since
20041 is already merged into working dir - this change [wrt 20045] is
visible in the status/diff.

5. commit: this commits the merge [that joins the 2 heads into 1].
This new merge commit is now both the parent and tip.

changeset:   20046:2f433672fa82
user:        Mark F. Adams <mark.adams at columbia.edu>

6. push: transmit all local commits to remote repo.

hope this clarifies the issue,
Satish


> 
> You just follow hg's  messages after each command is invoked
> 
> hg pull
> hg merge
>  [don't do hg status/diff now]
> hg commit
> hg push
> 
> Satish
> 
> On Wed, 24 Aug 2011, Mark F. Adams wrote:
> 
> > I tried revert on this file (which I did not touch) iga.c but got a message to try 'hg revert help' ... which was no help.
> > 
> > So I just went ahead and committed the whole thing and and that cleared it up.  I've appended the diffs, but as I said I've never touched this file.  Hope I didn't clobber someones stuff,
> > 
> > Mark
> > 
> > diff -r 4bf480f9a778 src/dm/impls/iga/iga.c
> > --- a/src/dm/impls/iga/iga.c    Wed Aug 24 17:08:17 2011 -0700
> > +++ b/src/dm/impls/iga/iga.c    Wed Aug 24 17:43:52 2011 -0700
> > @@ -1555,24 +1555,22 @@
> >  #define __FUNCT__ "CreateKnotVector"
> >  PetscErrorCode CreateKnotVector(PetscInt N,PetscInt p,PetscInt C,PetscInt m, PetscReal *U,PetscReal U0,PetscReal Uf)
> >  {
> > -  PetscInt i,j;
> > +  PetscInt  i,j;
> >    PetscReal dU;
> > -  PetscInt  k0;
> >  
> >    PetscFunctionBegin;
> > -  for(i=0;i<p+1;i++) /* open part */
> > +
> > +  dU = (Uf-U0)/N;
> > +  for(i=0;i<(N-1);i++) /* insert N-1 knots */
> > +    for(j=0;j<(p-C);j++) /* p-C times */
> > +      U[(p+1) + i*(p-C) + j] = U0 + (i+1)*dU;
> > +
> > +  for(i=0;i<(p+1);i++) /* open part */
> >    {
> >      U[i] = U0;
> >      U[m-i-1] = Uf;
> >    }
> >  
> > -  dU = (Uf-U0)/((PetscReal) N);
> > -  k0 = p+1;
> > -  for(i=0;i<(N-1);i++) /* insert N-1 knots */
> > -  {
> > -    for(j=0;j<(p-C);j++) /* p-C+1 times */
> > -      U[k0 + i*(p-C) + j] = U0+((PetscReal) (i+1))*dU;
> > -  }
> >    PetscFunctionReturn(0);
> >  }
> >  
> > @@ -1580,29 +1578,22 @@
> >  #define __FUNCT__ "CreatePeriodicKnotVector"
> >  PetscErrorCode CreatePeriodicKnotVector(PetscInt N,PetscInt p,PetscInt C,PetscInt m, PetscReal *U,PetscReal U0,PetscReal Uf)
> >  {
> > -  PetscInt i,j;
> > +  PetscInt  i,j;
> >    PetscReal dU;
> > -  PetscInt  k0;
> >  
> > -  PetscFunctionBegin; /* periodic part */
> > -  U[p] = U0;
> > -  U[m-p-1] = Uf;
> > +  PetscFunctionBegin;
> >  
> > -  dU = (Uf-U0)/((PetscReal) N);
> > -  k0 = p+1;
> > -  for(i=0;i<(N-1);i++) /* insert N-1 knots */
> > +  dU = (Uf-U0)/N;
> > +  for(i=0;i<(N+1);i++) /* insert N+1 knots */
> > +    for(j=0;j<(p-C);j++) /* p-C times */
> > +      U[(C+1) + i*(p-C) + j] = U0 + i*dU;
> > +
> > +  for(i=0;i<(C+1);i++) /* periodic part */
> >    {
> > -    for(j=0;j<(p-C);j++) /* p-C+1 times */
> > -      U[k0 + i*(p-C) + j] = U0+((PetscReal) (i+1))*dU;
> > +    U[i] = U0 - (Uf - U[(m-1-p)-(C+1)+i]);
> > +    U[m-(C+1)+i] = Uf + (U[p+1+i] - U0);
> >    }
> >  
> > -  for(i=0;i<p;i++)
> > -    {
> > -      U[i] = -U[m-p-1]+U[m-p-1-(p-i)];
> > -      U[m-p+i] = U[m-p-1]+U[p+i+1];
> > -    }
> > -
> > -
> >    PetscFunctionReturn(0);
> >  }
> > 
> > 
> > 
> > On Aug 24, 2011, at 8:45 PM, Jed Brown wrote:
> > 
> > > On Wed, Aug 24, 2011 at 19:16, Mark F. Adams <mark.adams at columbia.edu> wrote:
> > > I'm stuck.  I seem to have some file that I know nothing about:
> > > 
> > > examples/tutorials> hg status -m
> > > M src/dm/impls/iga/iga.c
> > > 
> > > that seems to be holding me up from doing just about anything with hg.  I've tried reverting it with not luck.
> > > 
> > > hg diff   -- to see if there is anything you want to keep
> > > hg revert src/dm/impls/iga/iga.c   -- to discard those changes
> > > hg update -C   -- to discard any changes in the current working tree and update to the given revision (tip, by default)
> > > 
> > > If you have a problem with these, paste the full output.
> > 
> > 
> 
> 




More information about the petsc-dev mailing list