[cig-commits] commit: tests with mq patches applied, skipped tree marks

Mercurial hg at geodynamics.org
Mon Nov 24 11:26:48 PST 2008


changeset:   9:1be1edb45e3e
user:        Robin Farine <robin.farine at terminus.org>
date:        Mon Oct 23 19:35:26 2006 +0200
files:       forest.py test-forest test-forest.out
description:
tests with mq patches applied, skipped tree marks

Some forest commands abort when a tree has mq patches applied, others
just skip such a tree. Add tests for these cases.

When a tree is skipped, mark it with a message just below the tree
root by using ui.write() instead of ui.warn().


diff -r 801dc644d715 -r 1be1edb45e3e forest.py
--- a/forest.py	Mon Oct 23 16:58:08 2006 +0200
+++ b/forest.py	Mon Oct 23 19:35:26 2006 +0200
@@ -152,7 +152,8 @@ class ForestSnapshot(object):
             root, rev, path = t.info(pathalias)
             ui.write("[%s]\n" % root)
             if path is None:
-                ui.warn(_("no path alias '%s' defined\n") % pathalias)
+                ui.write(_("skipped, no path alias '%s' defined\n\n")
+                         % pathalias)
                 continue
             if repo is None:
                 repo = toprepo
@@ -160,10 +161,10 @@ class ForestSnapshot(object):
                 try:
                     repo = repository(ui, root)
                 except RepoError:
-                    ui.warn(_("no valid repo found\n"))
+                    ui.write(_("skipped, no valid repo found\n\n"))
                     continue
             if mq_patches_applied(repo.root):
-                ui.warn(_("mq patches applied\n"))
+                ui.write(_("skipped, mq patches applied\n\n"))
                 continue
             func(repo, path, rev)
             ui.write("\n")
@@ -220,7 +221,7 @@ def clone(ui, source, dest, **opts):
             srcpath = os.path.join(source, subdir)
             destpath = os.path.join(dest, subdir)
         if mq_patches_applied(srcpath):
-            raise util.Abort(_("'%s' has mq patches applied\n") % root)
+            raise util.Abort(_("'%s' has mq patches applied") % root)
         roots.append((root, srcpath, destpath))
     for root in roots:
         destpfx = os.path.dirname(root[2])
@@ -290,13 +291,13 @@ def seed(ui, repo, snapshot, pathalias, 
         dest = util.localpath(root)
         psect = section + '.paths'
         if not cfg.has_option(psect, pathalias):
-            ui.warn(_("no path alias '%s' defined for tree '%s'\n") %
+            ui.write(_("skipped, no path alias '%s' defined for tree '%s'\n") %
                     (pathalias, dest))
             continue
         source = cfg.get(psect, pathalias)
         ui.write("[%s]\n" % root)
         if os.path.exists(dest):
-            ui.warn(_("destination '%s' already exists, skipping\n") % dest)
+            ui.write(_("skipped, destination '%s' already exists\n") % dest)
             continue
         destpfx = os.path.dirname(dest)
         if destpfx and not os.path.exists(destpfx):
@@ -325,7 +326,7 @@ def status(ui, repo, *pats, **opts):
 
     for root in enumerate_repos():
         mqflag = ""
-        if mq_patches_applied(repo.root):
+        if mq_patches_applied(root):
             mqflag = " *mq*"
         ui.write("[%s]%s\n" % (root, mqflag))
         repo = repository(ui, root)
diff -r 801dc644d715 -r 1be1edb45e3e test-forest
--- a/test-forest	Mon Oct 23 16:58:08 2006 +0200
+++ b/test-forest	Mon Oct 23 19:35:26 2006 +0200
@@ -53,6 +53,7 @@ echo "# fseed"
 echo "# fseed"
 hg clone toplevel newtop
 hg fseed --cwd newtop ../top-snap default
+rm -rf newtop
 
 echo "# fpull"
 hg fpull --cwd topcopy -u ../top-snap default | sed "s@$HGTMP at HGTMP@g"
@@ -63,3 +64,26 @@ hg remove --cwd topcopy d/d/f2
 hg remove --cwd topcopy d/d/f2
 hg commit --cwd topcopy/d/d -m "remove new file" -d "0 0"
 hg fpush --cwd topcopy ../top-snap default | sed "s@$HGTMP at HGTMP@g"
+
+# create an mq patch in topcopy/t
+hg qinit --cwd topcopy/t
+hg qnew --cwd topcopy/t mq-patch
+echo "zzz" > topcopy/t/z
+hg add --cwd topcopy/t z
+hg qrefresh --cwd topcopy/t
+
+echo "# fstatus + mq"
+hg fstatus --cwd topcopy
+
+echo "# fclone + mq"
+hg fclone topcopy newtop
+rm -rf newtop
+
+echo "# fsnap + mq"
+hg fsnap --cwd topcopy ../top-snap1
+
+echo "# fpull + mq"
+hg fpull --cwd topcopy -u ../top-snap default | sed "s@$HGTMP at HGTMP@g"
+
+echo "# fpush + mq"
+hg fpush --cwd topcopy ../top-snap default | sed "s@$HGTMP at HGTMP@g"
diff -r 801dc644d715 -r 1be1edb45e3e test-forest.out
--- a/test-forest.out	Mon Oct 23 16:58:08 2006 +0200
+++ b/test-forest.out	Mon Oct 23 19:35:26 2006 +0200
@@ -133,3 +133,54 @@ adding file changes
 adding file changes
 added 1 changesets with 1 changes to 1 files
 
+# fstatus + mq
+[.]
+
+[d/d/t]
+
+[t] *mq*
+
+[t/t]
+
+# fclone + mq
+abort: 't' has mq patches applied
+# fsnap + mq
+abort: 't' has mq patches applied
+# fpull + mq
+[.]
+pulling from HGTMP/test-forest/toplevel
+searching for changes
+no changes found
+
+[d/d/t]
+pulling from HGTMP/test-forest/toplevel/d/d/t
+searching for changes
+no changes found
+
+[t]
+skipped, mq patches applied
+
+[t/t]
+pulling from HGTMP/test-forest/toplevel/t/t
+searching for changes
+no changes found
+
+# fpush + mq
+[.]
+pushing to HGTMP/test-forest/toplevel
+searching for changes
+no changes found
+
+[d/d/t]
+pushing to HGTMP/test-forest/toplevel/d/d/t
+searching for changes
+no changes found
+
+[t]
+skipped, mq patches applied
+
+[t/t]
+pushing to HGTMP/test-forest/toplevel/t/t
+searching for changes
+no changes found
+



More information about the CIG-COMMITS mailing list