comparison src/com/tmate/hgkit/fs/RepositoryLookup.java @ 49:26e3eeaa3962

branch and user filtering for log operation
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 15 Jan 2011 01:15:38 +0100
parents e34f90b9ded1
children
comparison
equal deleted inserted replaced
48:e34f90b9ded1 49:26e3eeaa3962
6 import java.io.File; 6 import java.io.File;
7 import java.util.ArrayList; 7 import java.util.ArrayList;
8 import java.util.Arrays; 8 import java.util.Arrays;
9 import java.util.Collections; 9 import java.util.Collections;
10 import java.util.Iterator; 10 import java.util.Iterator;
11 import java.util.LinkedHashSet;
11 import java.util.LinkedList; 12 import java.util.LinkedList;
12 import java.util.List; 13 import java.util.List;
14 import java.util.Set;
13 15
14 import com.tmate.hgkit.ll.HgRepository; 16 import com.tmate.hgkit.ll.HgRepository;
15 import com.tmate.hgkit.ll.LocalHgRepo; 17 import com.tmate.hgkit.ll.LocalHgRepo;
16 18
17 /** 19 /**
55 public static class Options { 57 public static class Options {
56 58
57 public String repoLocation; 59 public String repoLocation;
58 public List<String> files; 60 public List<String> files;
59 public int limit = -1; 61 public int limit = -1;
62 public Set<String> users;
63 public Set<String> branches;
60 64
61 public static Options parse(String[] commandLineArgs) { 65 public static Options parse(String[] commandLineArgs) {
62 Options rv = new Options(); 66 Options rv = new Options();
63 List<String> args = Arrays.asList(commandLineArgs); 67 List<String> args = Arrays.asList(commandLineArgs);
64 LinkedList<String> files = new LinkedList<String>(); 68 LinkedList<String> files = new LinkedList<String>();
82 throw new IllegalArgumentException(); 86 throw new IllegalArgumentException();
83 } 87 }
84 rv.limit = Integer.parseInt(it.next()); 88 rv.limit = Integer.parseInt(it.next());
85 break; 89 break;
86 } 90 }
91 case (int) 'u' : {
92 if (rv.users == null) {
93 rv.users = new LinkedHashSet<String>();
94 }
95 rv.users.add(it.next());
96 break;
97 }
98 case (int) 'b' : {
99 if (rv.branches == null) {
100 rv.branches = new LinkedHashSet<String>();
101 }
102 rv.branches.add(it.next());
103 break;
104 }
87 } 105 }
88 } else { 106 } else {
89 // filename 107 // filename
90 files.add(arg); 108 files.add(arg);
91 } 109 }