Index: src/test/java/com/xpn/xwiki/XWikiTest.java
===================================================================
--- src/test/java/com/xpn/xwiki/XWikiTest.java	(révision 4472)
+++ src/test/java/com/xpn/xwiki/XWikiTest.java	(copie de travail)
@@ -19,9 +19,12 @@
  */
 package com.xpn.xwiki;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import org.jmock.Mock;
@@ -88,6 +91,35 @@
                     return null;
                 }
             });
+        this.mockXWikiStore.stubs().method("searchDocumentsNames")./*with(eq("")).*/will(
+            new CustomStub("Implements XWikiStoreInterface.searchDocumentsNames")
+            {
+                public Object invoke(Invocation invocation) throws Throwable
+                {
+                    XWikiContext context = (XWikiContext) invocation.parameterValues.get(1);
+                    
+                    String database = context.getDatabase();
+                    
+                    if (database == null || database.length() == 0)
+                        database = WIKI_NAME;
+                    
+                    if (!databases.containsKey(database))
+                        throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_DELETE_DATABASE,
+                            "Database " + database + " does not exists.");
+                    
+                    Map docs = (Map)databases.get(database);
+                    
+                    List listNames = new ArrayList();
+                    
+                    for (Iterator it = docs.values().iterator(); it.hasNext();) {
+                        XWikiDocument doc = (XWikiDocument)it.next();
+                        
+                        listNames.add(doc.getFullName());
+                    }
+                    
+                    return listNames;
+                }
+            });
         this.mockXWikiStore.stubs().method("getTranslationList").will(
             returnValue(Collections.EMPTY_LIST));
 
@@ -142,4 +174,48 @@
 
         assertTrue(copy.getCreationDate().equals(sourceCreationDate));
     }
+    
+    public void testContentAfterWikiCopyVirtual() throws XWikiException
+    {
+        ((Map)this.databases.get(TARGET_WIKI_NAME)).clear();
+        
+        String database = this.context.getDatabase();
+        boolean virtual = this.context.isVirtual();
+        
+        this.context.setDatabase(WIKI_NAME);
+        this.context.setVirtual(true);
+       
+        this.xwiki.copyWikiWeb(null, WIKI_NAME, null, TARGET_WIKI_NAME, null, false, context);
+        XWikiDocument copy = this.xwiki.getDocument(TARGET_WIKI_NAME + ":" + this.document.getFullName(), context);
+
+        System.out.println("{"+document.getContent()+"}" + "{" + copy.getContent() + "}");
+        
+        assertEquals(document.getContent(), copy.getContent());
+        
+        this.context.setDatabase(database);
+        this.context.setVirtual(virtual);
+    }
+    
+    public void testContentAfterWikiCopyIncludeVirtual() throws XWikiException
+    {
+        ((Map)this.databases.get(TARGET_WIKI_NAME)).clear();
+        
+        String database = this.context.getDatabase();
+        boolean virtual = this.context.isVirtual();
+        
+        this.context.setDatabase(WIKI_NAME);
+        this.context.setVirtual(true);
+
+        List listNames = new ArrayList();
+        listNames.add(this.document.getFullName());
+        
+        this.xwiki.copyWikiWeb(null, WIKI_NAME, listNames, TARGET_WIKI_NAME, null, false, context);
+        XWikiDocument copy = this.xwiki.getDocument(TARGET_WIKI_NAME + ":" + this.document.getFullName(), context);
+
+        assertEquals("#includeInContext(\"" + WIKI_NAME + ":"
+            + document.getFullName() + "\")", copy.getContent());
+        
+        this.context.setDatabase(database);
+        this.context.setVirtual(virtual);
+    }
 }
Index: src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- src/main/java/com/xpn/xwiki/XWiki.java	(révision 4472)
+++ src/main/java/com/xpn/xwiki/XWiki.java	(copie de travail)
@@ -3301,6 +3301,13 @@
             false, context);
     }
 
+    public boolean copyDocument(String docname, String sourceWiki, boolean includeContent,
+        String targetWiki, String wikilanguage, XWikiContext context) throws XWikiException
+    {
+        return copyDocument(docname, docname, includeContent, sourceWiki, targetWiki,
+            wikilanguage, true, false, false, context);
+    }
+    
     public boolean copyDocument(String docname, String targetdocname, String sourceWiki,
         String targetWiki, String wikilanguage, boolean reset, boolean force, XWikiContext context)
         throws XWikiException
@@ -3508,12 +3515,12 @@
     }
 
     public int copyWikiWeb(String web, String sourceWiki, String targetWiki, String wikilanguage,
-        XWikiContext context) throws XWikiException
+        boolean clean, XWikiContext context) throws XWikiException
     {
-        return copyWikiWeb(web, sourceWiki, targetWiki, wikilanguage, false, context);
+        return copyWikiWeb(web, sourceWiki, null, targetWiki, wikilanguage, clean, context);
     }
-
-    public int copyWikiWeb(String web, String sourceWiki, String targetWiki, String wikilanguage,
+    
+    public int copyWikiWeb(String web, String sourceWiki, Collection docsToInclude, String targetWiki, String wikilanguage,
         boolean clean, XWikiContext context) throws XWikiException
     {
         String db = context.getDatabase();
@@ -3548,7 +3555,7 @@
 
             for (Iterator it = list.iterator(); it.hasNext();) {
                 String docname = (String) it.next();
-                copyDocument(docname, sourceWiki, targetWiki, wikilanguage, context);
+                copyDocument(docname, sourceWiki, docsToInclude != null ? docsToInclude.contains(docname) : false, targetWiki, wikilanguage, context);
                 nb++;
             }
             return nb;
