Mercurial > hg-git
changeset 1078:a70c1f6caead
fetch: mark remote HEAD as public phase
To help improve the speed Mercurial operations, we shouldn't leave the whole
repository in the draft phase. The only hueristic git has for 'public' is
remote HEAD. Therefore, if remote HEAD exists then we use it to mark the
corresponding local commit as public.
For now, we'll put this behind a config flag for easier rollback.
author | Sean Farley <sean@farley.io> |
---|---|
date | Fri, 15 May 2015 15:02:24 -0700 |
parents | c2b555f79f12 |
children | fda826275060 |
files | hggit/git_handler.py tests/test-bookmark-workflow.t tests/test-clone.t |
diffstat | 3 files changed, 27 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py Wed Nov 01 20:24:12 2017 -0500 +++ b/hggit/git_handler.py Fri May 15 15:02:24 2015 -0700 @@ -22,6 +22,7 @@ commands, context, encoding, + phases, util as hgutil, url, ) @@ -317,6 +318,23 @@ self.save_map(self.map_file) + if rnode and self.ui.configbool('hggit', 'usephases'): + lock = self.repo.lock() + try: + tr = self.repo.transaction("phase") + try: + phases.advanceboundary(self.repo, tr, phases.public, + [rnode]) + except TypeError: + # hg < 3.2 + phases.advanceboundary(self.repo, phases.public, + [rnode]) + tr.close() + finally: + if tr is not None: + tr.release() + lock.release() + if imported == 0: return 0
--- a/tests/test-bookmark-workflow.t Wed Nov 01 20:24:12 2017 -0500 +++ b/tests/test-bookmark-workflow.t Fri May 15 15:02:24 2015 -0700 @@ -76,13 +76,17 @@ 1 7bcd915dc873 "add beta" bookmarks: [b1] 0 3442585be8a6 "add alpha" bookmarks: [] $ cd .. - $ hg clone -q gitremoterepo hggitlocalrepo + $ hg clone -q gitremoterepo hggitlocalrepo --config hggit.usephases=True $ cd hggitlocalrepo $ hggitstate 3 03769a650ded 55b133e1d558 "add delta" bookmarks: [master] 2 ca33a262eb46 d338971a96e2 "add gamma" bookmarks: [] 1 7fe02317c63d 9497a4ee62e1 "add beta" bookmarks: [b1] 0 ff7a2f2d8d70 7eeab2ea75ec "add alpha" bookmarks: [] + +Make sure that master is public + $ hg phase -r master + 3: public $ cd .. No changes
--- a/tests/test-clone.t Wed Nov 01 20:24:12 2017 -0500 +++ b/tests/test-clone.t Fri May 15 15:02:24 2015 -0700 @@ -32,6 +32,10 @@ date: Mon Jan 01 00:00:10 2007 +0000 summary: add alpha +Make sure this is still draft since we didn't pull remote's HEAD + $ hg -R hgrepo-a phase -r alpha + 0: draft + clone a branch $ hg clone -r beta gitrepo hgrepo-b | grep -v '^updating' importing git objects into hg