problems with the hg-git plugin and bookmarks

Uwe Brauer oub at mat.ucm.es
Wed Sep 7 11:41:11 UTC 2016



   > Until your patch lands upstream, the wisest course is to leave your
   > work in an open branch. If you're just submitting it as a patch,
   > you can pull from upstream and rebase your work on top of that
   > (since you haven't pushed your commits to any other public
   > repository).


Thanks but I am not entirely sure I understand that workflow, most
likely because I don't understand «rebase» well enough.

Here is a basic repo which reflects my situation

 hg init
 hg bookmark master
 echo Upstream1 > main.txt
 hg add main.txt
 hg commit -m "Up one"
 hg bookmark exam
 echo exam1 > exam.txt
 hg add exam.txt
 hg commit -m "Exam 1"
 echo exam2 >> exam.txt
 hg commit -m "exam2"
 hg update master
 echo uwe-three >> main.txt
 hg commit -m "Uwe three"
 

The result of  hg log -G is 

@  changeset:   3:62af2f2e8eeb
|  bookmark:    master
|  tag:         tip
|  parent:      0:e8f73d6490e2
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Wed Sep 07 11:28:48 2016 +0000
|  summary:     Uwe three
|
| o  changeset:   2:96b67c7548e1
| |  bookmark:    exam
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Wed Sep 07 11:28:47 2016 +0000
| |  summary:     exam2
| |
| o  changeset:   1:34c977558c2d
|/   user:        Uwe Brauer <oub at mat.ucm.es>
|    date:        Wed Sep 07 11:28:47 2016 +0000
|    summary:     Exam 1
|
o  changeset:   0:e8f73d6490e2
   user:        Uwe Brauer <oub at mat.ucm.es>
   date:        Wed Sep 07 11:28:46 2016 +0000
   summary:     Up one

So I want to send a patch of my branch exam.

So I do

hg rebase -s 1 -d 3
obtaining hg log -G


  bookmark:    exam
|  tag:         tip
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Wed Sep 07 11:28:47 2016 +0000
|  summary:     exam2
|
o  changeset:   2:9c310e702a2a
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Wed Sep 07 11:28:47 2016 +0000
|  summary:     Exam 1
|
@  changeset:   1:62af2f2e8eeb
|  bookmark:    master
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Wed Sep 07 11:28:48 2016 +0000
|  summary:     Uwe three
|
o  changeset:   0:e8f73d6490e2
   user:        Uwe Brauer <oub at mat.ucm.es>
   date:        Wed Sep 07 11:28:46 2016 +0000
   summary:     Up one

That is a complete linear history.


BTW I first tried hg rebase -s 2 -d 4 which is not correct but resulted
in an enigmatic error message I will write about in a different message.

Now I could generate a patch, (if my branch contained more changesets, I
might either collapse them or could  have used the --amend option)

The central question is:

how could I go back to my original repo? What is
the «inverse operation»  hg rebase -s 1 -d 3?


You might ask why should I need it? The answer is:


    -  if I want to pull (my repo is now not sync with the main repo so
       pulling will cause problems)

    -  if I had to modify the patch I prefer to have my original
       branches.

I tried 
hg rebase -s 2 -d 1
«nothing to rebase» and 
hg rebase -s 3 -d 0

But then obtained the wrong tree
  changeset:   3:c17516b989fd
|  bookmark:    exam
|  bookmark:    master
|  tag:         tip
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Wed Sep 07 11:28:47 2016 +0000
|  summary:     exam2
|
o  changeset:   2:78ede21a2943
|  parent:      0:e8f73d6490e2
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Wed Sep 07 11:28:47 2016 +0000
|  summary:     Exam 1
|
| o  changeset:   1:62af2f2e8eeb
|/   user:        Uwe Brauer <oub at mat.ucm.es>
|    date:        Wed Sep 07 11:28:48 2016 +0000
|    summary:     Uwe three
|
o  changeset:   0:e8f73d6490e2
   user:        Uwe Brauer <oub at mat.ucm.es>
   date:        Wed Sep 07 11:28:46 2016 +0000
   summary:     Up one

So if it is not possible to do the inverse operation with rebase,


the workflow should be.



    -  clone auctex to auctex-hg

    -  generate branches and write code.

    -  pull for the last time to the master bookmark

    -  clone the repo: hg clone auctex-hg auctex-bridge

    -  rebase auctex-bridge generate a patch submit.

    -  delete auctex-bridge.

If that is the only way to do it I can live with it, but I find it
cumbersome, I thought mercurial is «one repo to rule them all»

Uwe Brauer 




More information about the Mercurial mailing list