hg-git: push -d default seems not to work.

Uwe Brauer oub at mat.ucm.es
Sat May 6 16:48:28 UTC 2017


   > On Fri, 05 May 2017 16:26:45 -0400, Uwe Brauer <oub at mat.ucm.es> wrote:

   > I'm not clear on some of the details of what you are doing. The
   > original question was how to push a merge without one of its ancestor
   > branches. That implies you effectively want to fold up the changes on
   > your feature branch and rebase them onto default as one change. But
   > here you mention grafting, and below you mention exporting, which
   > sounds like you want the _individual_ commits to be copied to the
   > default branch. So, are you looking to get one commit, individual
   > commits, or it depends on the situation?

Maybe at that point of the thread my original problem is a bit lost. (I
did not mention grafting, it was pointed out to me).

    -  my preferences is: I want on a named branches, with as many
       commits as necessary. When I am satisfied I want to merge (either
       the feature branch into default or the other way around, see
       below). That results in a graph I understand even months later.

    -  the maintainer of the repo in question (a git repo) want no
       clutter but single clean commits, and they don't want branches
       neither (although I think one can delete whole branches in git,
       but I am not sure).

So I want a compromise between both positions.

   > The implementation is different, but the result is effectively the
   > same IIRC. I don't see why you couldn't add --collapse to `rebase
   > --keep`, so that you keep the originals while you flatten them on
   > default.


   > Do you remember what your concern was?


Sure:


    -  I found it a bit dangerous, if you select the wrong rev numbers
       you might mess up things (that can not happen with a merge).

    -  after a couple of weeks I might not be able to say what I based
       on what, if the graph could represent a rebase that would be
       different something like this

For example a merge is represented as
@    changeset:   6941:8fee77df90d7
|\   bookmark:    master
| |  tag:         tip
| |  parent:      6938:0d01b9868000
| |  parent:      6940:e6d514f7926a
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Sat May 06 10:48:53 2017 +0000
| |  summary:     Merged
| |
| o  changeset:   6940:e6d514f7926a

Why not represent a rebase like

@    changeset:   6941:8fee77df90d7
|*   bookmark:    master
| *  tag:         tip
| |  parent:      6938:0d01b9868000
| |  parent:      6940:e6d514f7926a
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Sat May 06 10:48:53 2017 +0000
| |  summary:     Merged
| |
| o  changeset:   6940:e6d514f7926a

Or something like this. But this is a different topic and I have the
feeling there are not may people who would like it.





   > Here's an alternative, if you are OK with the single changeset that
   > you would have ended up with when you were trying to push only the
   > merge commit:

That sounds very interesting, let me comment on it and then provide a
series of commandos in order to see whether I understood you correctly.

   > 1) create your feature branch, and hack as needed, as you've been
   > doing

   > 2) merge default into your feature branch as needed (you were
   > merging the other way)

Oh well, yes and no. If there was changes upstream and I pulled, then
you are right. But if not, then not because I would obtain when trying
to merge
abort: merging with a working directory ancestor has no effect
so what I am supposed to do in scenario if nothing happened in upstream
and the is nothing to pull???

Here is what I did and it seems to have worked out nicely my only doubt
is the merge process: to merge default into feature if nothing happened
in upstream??

Thanks

Uwe 

hg init repo-server
cd repo-server
echo master1 > test.txt
hg add test.txt
hg commit   -m "master1"
echo master2 >> test.txt
hg commit   -m "master2"


cd ..

hg clone repo-server repo-local
cd repo-local

hg branch feature
echo feature-one > feature.txt
hg add feature.txt
hg commit -m "feature1"
echo feature-two >> feature.txt
hg commit -m "Last and best commit"
# now somthing is happending in the server
cd ../repo-server
hg update default
echo default >> test.txt
hg commit -m "back to default"
cd ../repo-local
# we pull the changes from upstream but what to do if there
# were none?
hg pull -u
hg up feature
hg merge default
hg commit -m "Merged default once into feature"
hg update default
hg revert --all -r feature
hg commit -m "collapsed patch for submission"
hg push -r .






More information about the Mercurial mailing list