changeset 78:97152eaa30fa

fpull -p option for partial forests
author Mark Reinhold <mr@sun.com>
date Thu, 29 Nov 2007 20:48:02 -0800
parents de0d2b10ed66
children 1858f812ef71
files forest.py test-forest test-forest.out
diffstat 3 files changed, 53 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/forest.py	Tue Nov 13 16:06:48 2007 -0500
+++ b/forest.py	Thu Nov 29 20:48:02 2007 -0800
@@ -996,17 +996,20 @@
             try:
                 tree.getrepo(ui)
             except RepoError:
-                # Need to clone
-                quiet = ui.quiet
-                try:
-                    ui.quiet = True     # Hack to shut up qclone's ui.status()
-                    qclone(ui=ui,
-                           source=srcpath, sroot=source,
-                           dest=destpath, rpath=rpath,
-                           opts=opts)
-                except util.Abort, err:
-                    ui.warn(_("skipped: %s\n") % err)
-                ui.quiet = quiet
+                if opts['partial']:
+                    ui.status(_("repository not previously cloned, skipping\n"))
+                else:
+                    # Need to clone
+                    quiet = ui.quiet
+                    try:
+                        ui.quiet = True # Hack to shut up qclone's ui.status()
+                        qclone(ui=ui,
+                               source=srcpath, sroot=source,
+                               dest=destpath, rpath=rpath,
+                               opts=opts)
+                    except util.Abort, err:
+                        ui.warn(_("skipped: %s\n") % err)
+                    ui.quiet = quiet
                 return
         try:
             commands.pull(ui, tree.getrepo(ui), srcpath, **opts)
@@ -1295,7 +1298,9 @@
              _('hg foutgoing [OPTION]... [DEST]')),
         "^fpull" :
             (pull,
-             [walkhgopts, snapfileopts] + cmd_options(ui, 'pull', remove=('f',)),
+             [('p', 'partial', False,
+               _("do not clone source repositories not previously cloned")),
+              walkhgopts, snapfileopts] + cmd_options(ui, 'pull', remove=('f',)),
              _('hg fpull [OPTION]... [SOURCE]')),
         "^fpush" :
             (push,
--- a/test-forest	Tue Nov 13 16:06:48 2007 -0500
+++ b/test-forest	Thu Nov 29 20:48:02 2007 -0800
@@ -201,3 +201,15 @@
 ln -s . circular/a/b
 ln -s .. circular/a/c
 hg fstatus -R circular
+
+echo "# fpull --partial"
+hg init partial
+hg init partial/a
+echo "a" >partial/a/f
+hg init partial/b
+echo "b" >partial/b/f
+hg commit --cwd partial/a -A -m init -d "0 0"
+hg commit --cwd partial/b -A -m init -d "0 0"
+hg fclone partial partial-clone | sed "s@\(/private\)*$HGTMP@HGTMP@g"
+rm -rf partial-clone/b
+hg --cwd partial-clone fpull --partial | sed "s@\(/private\)*$HGTMP@HGTMP@g"
--- a/test-forest.out	Tue Nov 13 16:06:48 2007 -0500
+++ b/test-forest.out	Thu Nov 29 20:48:02 2007 -0800
@@ -886,3 +886,27 @@
 
 [a/a]
 
+# fpull --partial
+adding f
+adding f
+[.]
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+[a]
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+[b]
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+[.]
+pulling from HGTMP/test-forest/partial
+no changes found
+
+[a]
+pulling from HGTMP/test-forest/partial/a
+searching for changes
+no changes found
+
+[b]
+repository not previously cloned, skipping
+