]> git.pld-linux.org Git - packages/lftp.git/blob - lftp-git.patch
- up to 4.7.7
[packages/lftp.git] / lftp-git.patch
1 From ebc2ba35b578cf7241852fafddd42993e2713d94 Mon Sep 17 00:00:00 2001
2 From: "Alexander V. Lukyanov" <lavv17f@gmail.com>
3 Date: Mon, 12 Sep 2016 10:25:54 +0300
4 Subject: [PATCH] MirrorJob: new option --directory (-F) to mirror top
5  directories by glob pattern.
6
7 ---
8  src/MirrorJob.cc | 21 +++++++++++++++------
9  src/MirrorJob.h  |  2 ++
10  2 files changed, 17 insertions(+), 6 deletions(-)
11
12 diff --git a/src/MirrorJob.cc b/src/MirrorJob.cc
13 index 3f25941..5ba40a0 100644
14 --- a/src/MirrorJob.cc
15 +++ b/src/MirrorJob.cc
16 @@ -753,7 +753,7 @@ void MirrorJob::HandleListInfoCreation(const FileAccessRef& session,SMTaskRef<Li
17     if(flags&RETR_SYMLINKS)
18        list_info->FollowSymlinks();
19  
20 -   list_info->SetExclude(relative_dir,exclude);
21 +   list_info->SetExclude(relative_dir,top_exclude?top_exclude:exclude);
22     list_info->Roll();
23  }
24  
25 @@ -1722,6 +1722,7 @@ CMD(mirror)
26        {"verbose",optional_argument,0,'v'},
27        {"newer-than",required_argument,0,'N'},
28        {"file",required_argument,0,'f'},
29 +      {"directory",required_argument,0,'F'},
30        {"older-than",required_argument,0,OPT_OLDER_THAN},
31        {"size-range",required_argument,0,OPT_SIZE_RANGE},
32        {"dereference",no_argument,0,'L'},
33 @@ -1786,6 +1787,7 @@ CMD(mirror)
34     const char *recursion_mode=0;
35  
36     Ref<PatternSet> exclude;
37 +   Ref<PatternSet> top_exclude;
38  
39     if(!ResMgr::QueryBool("mirror:set-permissions",0))
40        flags|=MirrorJob::NO_PERMS;
41 @@ -1798,7 +1800,7 @@ CMD(mirror)
42     const char *target_dir=NULL;
43  
44     args->rewind();
45 -   while((opt=args->getopt_long("esi:x:I:X:nrpcRvN:LP:af:O:",mirror_opts,0))!=EOF)
46 +   while((opt=args->getopt_long("esi:x:I:X:nrpcRvN:LP:af:F:O:",mirror_opts,0))!=EOF)
47     {
48        switch(opt)
49        {
50 @@ -1875,11 +1877,17 @@ CMD(mirror)
51        case('N'):
52          newer_than=optarg;
53          break;
54 -      case('f'):
55 -      {
56 -        // mirror for a single file (or glob pattern).
57 +      case('f'): // mirror for a single file (or glob pattern).
58          recursion_mode="never";
59 -        MirrorJob::AddPattern(exclude,'I',basename_ptr(optarg));
60 +        /*fallthrough*/
61 +      case('F'): // mirror for a single directory (or glob pattern).
62 +      {
63 +        xstring pattern(basename_ptr(optarg));
64 +        if(opt=='F' && pattern.last_char()!='/')
65 +           pattern.append('/');
66 +        if(!top_exclude)
67 +           top_exclude=new PatternSet();
68 +        top_exclude->Add(PatternSet::INCLUDE,new PatternSet::Glob(pattern));
69          source_dir=dirname(optarg);
70          source_dir=alloca_strdup(source_dir); // save the temp string
71          break;
72 @@ -2106,6 +2114,7 @@ CMD(mirror)
73     j->SetFlags(flags,1);
74     j->SetVerbose(verbose);
75     j->SetExclude(exclude.borrow());
76 +   j->SetTopExclude(top_exclude.borrow());
77  
78     if(newer_than)
79        j->SetNewerThan(newer_than);
80 diff --git a/src/MirrorJob.h b/src/MirrorJob.h
81 index a3da287..a9a0df8 100644
82 --- a/src/MirrorJob.h
83 +++ b/src/MirrorJob.h
84 @@ -138,6 +138,7 @@ class MirrorJob : public Job
85     recursion_mode_t recursion_mode;
86     int  max_error_count;
87  
88 +   Ref<PatternSet> top_exclude;
89     Ref<PatternSet> my_exclude;
90     const PatternSet *exclude;
91  
92 @@ -249,6 +250,7 @@ class MirrorJob : public Job
93     void         SetExclude(const PatternSet *x) { exclude=x; }
94     void         SetSizeRange(Range *r) { my_size_range=r; size_range=my_size_range; }
95     void         SetSizeRange(const Range *r) { size_range=r; }
96 +   void         SetTopExclude(PatternSet *x) { top_exclude=x; }
97  
98     void         SetVerbose(int v) { verbose_report=v; }
99  
This page took 0.984859 seconds and 3 git commands to generate.