Pierre-Yves David avatar Pierre-Yves David committed 54a47b6 Draft

grpush: add a --freezed flag

This flag push changeset listed in `.hgguestrepo` only.

This closes issue #36.

Comments (0)

Files changed (3)

guestrepo/__init__.py

               "hg grpull [REPO [+]] [options]"),
    "grpush": (push,
               localopt + threadopt
-              + [('', 'new-branch', False, "create new branches if necessary")],
+              + [('', 'new-branch', False, "create new branches if necessary"),
+                 ('', 'frozen', False, "only revision specified in grstate"),
+                ],
               "hg grpush [REPO [+]] [options]"),
    "grupdate": (grupdate,
                 localopt + threadopt

guestrepo/guestrepo.py

                              args,
                              guests)
 
-    push_options = {'new_branch' : opts.get('new_branch')}
+    global_push_options = {'new_branch' : opts.get('new_branch')}
 
     def pushaction(ui, repo, guest):
         #if SUPPORTS_PHASES:
         # changesets need to be pushed.
         #if to_send or opts.get('local') or not SUPPORTS_PHASES:
         #    commands.push(ui, repo, guest.uri, **push_options)
+        push_options = global_push_options.copy()
+        if opts.get('frozen'):
+            push_options['rev'] = [guest.csid]
         commands.push(ui, repo, guest.uri, **push_options)
 
     mapping = True

tests/test-push.t

   pushing to /*/cramtests-*/test-push.t/gr2 (glob)
   searching for changes
   no changes found
+
+Test pushing with frozen changeset only
+
+  $ cd mygr
+  $ echo "c4" >> f
+  $ hg commit -m "c4"
+  $ echo "c5" >> f
+  $ hg commit -m "c5"
+  $ hg up '.^'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd $TESTDIR/host
+  $ hg grfreeze
+  $ hg ci -m 'new freeze'
+
+  $ hg grpush --frozen
+  pushing to /*/cramtests-*/test-push.t/gr1 (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  pushing to /*/cramtests-*/test-push.t/gr2 (glob)
+  searching for changes
+  no changes found
+  $ hg grpush
+  pushing to /*/cramtests-*/test-push.t/gr1 (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  pushing to /*/cramtests-*/test-push.t/gr2 (glob)
+  searching for changes
+  no changes found
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.