Changeset 2754


Ignore:
Timestamp:
22/09/2010 22:12:02 (20 months ago)
Author:
chris
Message:

Allow restoring directories with a single argument, using the remote name
as the local destination name also.

Location:
box/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/bin/bbackupquery/BackupQueries.cpp

    r2699 r2754  
    19521952{ 
    19531953        // Check arguments 
    1954         if(args.size() != 2) 
    1955         { 
    1956                 BOX_ERROR("Incorrect usage. restore [-drif] <remote-name> <local-name>"); 
     1954        if(args.size() < 1 || args.size() > 2) 
     1955        { 
     1956                BOX_ERROR("Incorrect usage. restore [-drif] <remote-name> " 
     1957                        "[<local-name>]"); 
    19571958                return; 
    19581959        } 
     
    19951996                return; 
    19961997        } 
     1998 
    19971999        if(dirID == BackupProtocolClientListDirectory::RootDirectory) 
    19982000        { 
     
    20002002                return; 
    20012003        } 
    2002          
    2003 #ifdef WIN32 
     2004 
    20042005        std::string localName; 
    2005         if(!ConvertConsoleToUtf8(args[1].c_str(), localName)) return; 
    2006 #else 
    2007         std::string localName(args[1]); 
    2008 #endif 
     2006 
     2007        if(args.size() == 2) 
     2008        { 
     2009                #ifdef WIN32 
     2010                        if(!ConvertConsoleToUtf8(args[1].c_str(), localName)) 
     2011                        { 
     2012                                return; 
     2013                        } 
     2014                #else 
     2015                        localName = args[1]; 
     2016                #endif 
     2017        } 
     2018        else 
     2019        { 
     2020                localName = args[0]; 
     2021        } 
    20092022 
    20102023        // Go and restore... 
  • box/trunk/bin/bbackupquery/documentation.txt

    r2637 r2754  
    120120< 
    121121 
    122 > restore [-drif] <directory-name> <local-directory-name> 
     122> restore [-drif] <directory-name> [<local-directory-name>] 
    123123 
    124124        Restores a directory to the local disc. The local directory specified 
    125         must not exist (unless a previous restore is being restarted). 
     125        must not exist (unless a previous restore is being restarted). If the 
     126        local directory is omitted, the default is to restore to the same 
     127        directory name and path, relative to the current local directory, 
     128        as set with the "lcd" command. 
    126129 
    127130        The root cannot be restored -- restore locations individually. 
  • box/trunk/test/bbackupd/testbbackupd.cpp

    r2510 r2754  
    20712071                        TestRemoteProcessMemLeaks("bbackupquery.memleaks"); 
    20722072 
     2073                        // Try a restore with just the remote directory name, 
     2074                        // check that it uses the same name in the local 
     2075                        // directory. 
     2076                        TEST_THAT(::mkdir("testfiles/restore-test", 0700) == 0); 
     2077 
     2078                        compareReturnValue = ::system(BBACKUPQUERY " " 
     2079                                "-Wwarning " 
     2080                                "-c testfiles/bbackupd.conf " 
     2081                                "\"lcd testfiles/restore-test\" " 
     2082                                "\"restore Test1\" " 
     2083                                "quit"); 
     2084                        TEST_RETURN(compareReturnValue, 
     2085                                BackupQueries::ReturnCode::Command_OK); 
     2086                        TestRemoteProcessMemLeaks("bbackupquery.memleaks"); 
     2087 
     2088                        // check that it restored properly 
     2089                        compareReturnValue = ::system(BBACKUPQUERY " " 
     2090                                "-Wwarning " 
     2091                                "-c testfiles/bbackupd.conf " 
     2092                                "\"compare -cEQ Test1 testfiles/restore-test/Test1\" "  
     2093                                "quit"); 
     2094                        TEST_RETURN(compareReturnValue, 
     2095                                BackupQueries::ReturnCode::Compare_Same); 
     2096                        TestRemoteProcessMemLeaks("bbackupquery.memleaks"); 
     2097 
    20732098                        // put the permissions back to sensible values 
    20742099                        #ifdef WIN32 
     
    20832108                                        0755) == 0); 
    20842109                        #endif 
    2085  
    20862110                } 
    20872111 
Note: See TracChangeset for help on using the changeset viewer.