Commits

Pierre-Yves David  committed ce97aea Draft

add --publish option to grfreeze

This option ensures that all changeset referenced in `.hgguestrepo` are in
public phases.

  • Participants
  • Parent commits 5fe8a33

Comments (0)

Files changed (3)

File guestrepo/__init__.py

                 + [('f', 'file', '', "update using a .hgguestrepo file", 'FILE')],
                 "hg grupdate [REPO [+]] [options]"),
    "grfreeze": (freeze,
-                [('f', 'file', '', "output state to a .hggrfrozen file",  'FILE')],
+                [('f', 'file', '', "output state to a .hggrfrozen file",  'FILE'),
+                 ('p', 'publish', False, "publish all record changeset"),]
+                + threadopt,
                 "hg grfreeze"),
    "grsummary": (summary,
                  [("i", "id", False, "Print the short changeset id"),

File guestrepo/guestrepo.py

     guests = getguests(repo)
     state = getstate(ui, repo, guests)
     statestr = makestatestr(state)
+    if opts.get('publish', False):
+        state = dict(state)
+        if not SUPPORTS_PHASES:
+            msg = 'your version of Mercurial does not support phases'
+            raise util.Abort(msg)
+        def publishaction(ui, repo, guest):
+            commands.phase(ui, repo, rev=[state[guest]],
+                           public=True, draft=None, secret=None, force=False)
+
+        workers = makeworkers(ui, opts)
+        try:
+            applyguests(ui, repo, guests, workers, publishaction,
+                        [], False, False)
+        finally:
+            workers.join()
+
 
     out_file = opts.get('file')
 

File tests/test-freeze.t

 State should have the same output as freeze
   $ hg grstate
   mygr       = mygr-name  ???????????????????????????????????????? (glob)
+
+Test --publish flag
+
+  $ cd mygr
+  $ echo echo c1 > f
+  $ hg commit -m 1
+  $ cd ..
+  $ hg grsummary --phase
+  mygr (default) draft tip
+  $ hg grfreeze --publish --traceback
+  $ hg grsummary --phase
+  mygr (default) public tip