[cig-commits] commit: fpull -p option for partial forests

Mercurial hg at geodynamics.org
Mon Nov 24 11:27:17 PST 2008


changeset:   78:97152eaa30fa
user:        Mark Reinhold <mr at sun.com>
date:        Thu Nov 29 20:48:02 2007 -0800
files:       forest.py test-forest test-forest.out
description:
fpull -p option for partial forests


diff -r de0d2b10ed66 -r 97152eaa30fa forest.py
--- 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 @@ def pull(ui, top, source="default", path
             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 @@ def uisetup(ui):
              _('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,
diff -r de0d2b10ed66 -r 97152eaa30fa test-forest
--- 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/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 at HGTMP@g"
+rm -rf partial-clone/b
+hg --cwd partial-clone fpull --partial | sed "s@\(/private\)*$HGTMP at HGTMP@g"
diff -r de0d2b10ed66 -r 97152eaa30fa test-forest.out
--- 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/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
+



More information about the CIG-COMMITS mailing list