You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PushLogUtils.java 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. /*
  2. * Copyright 2013 gitblit.com.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.gitblit.utils;
  17. import java.io.IOException;
  18. import java.text.DateFormat;
  19. import java.text.MessageFormat;
  20. import java.text.SimpleDateFormat;
  21. import java.util.ArrayList;
  22. import java.util.Arrays;
  23. import java.util.Collection;
  24. import java.util.Collections;
  25. import java.util.Date;
  26. import java.util.HashMap;
  27. import java.util.List;
  28. import java.util.Map;
  29. import java.util.Set;
  30. import java.util.TreeSet;
  31. import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
  32. import org.eclipse.jgit.api.errors.JGitInternalException;
  33. import org.eclipse.jgit.dircache.DirCache;
  34. import org.eclipse.jgit.dircache.DirCacheBuilder;
  35. import org.eclipse.jgit.dircache.DirCacheEntry;
  36. import org.eclipse.jgit.internal.JGitText;
  37. import org.eclipse.jgit.lib.CommitBuilder;
  38. import org.eclipse.jgit.lib.Constants;
  39. import org.eclipse.jgit.lib.FileMode;
  40. import org.eclipse.jgit.lib.ObjectId;
  41. import org.eclipse.jgit.lib.ObjectInserter;
  42. import org.eclipse.jgit.lib.PersonIdent;
  43. import org.eclipse.jgit.lib.RefUpdate;
  44. import org.eclipse.jgit.lib.RefUpdate.Result;
  45. import org.eclipse.jgit.lib.Repository;
  46. import org.eclipse.jgit.revwalk.RevCommit;
  47. import org.eclipse.jgit.revwalk.RevWalk;
  48. import org.eclipse.jgit.transport.ReceiveCommand;
  49. import org.eclipse.jgit.treewalk.CanonicalTreeParser;
  50. import org.eclipse.jgit.treewalk.TreeWalk;
  51. import org.slf4j.Logger;
  52. import org.slf4j.LoggerFactory;
  53. import com.gitblit.models.DailyLogEntry;
  54. import com.gitblit.models.PathModel.PathChangeModel;
  55. import com.gitblit.models.PushLogEntry;
  56. import com.gitblit.models.RefModel;
  57. import com.gitblit.models.RepositoryCommit;
  58. import com.gitblit.models.UserModel;
  59. /**
  60. * Utility class for maintaining a pushlog within a git repository on an
  61. * orphan branch.
  62. *
  63. * @author James Moger
  64. *
  65. */
  66. public class PushLogUtils {
  67. public static final String GB_PUSHES = "refs/gitblit/pushes";
  68. static final Logger LOGGER = LoggerFactory.getLogger(PushLogUtils.class);
  69. /**
  70. * Log an error message and exception.
  71. *
  72. * @param t
  73. * @param repository
  74. * if repository is not null it MUST be the {0} parameter in the
  75. * pattern.
  76. * @param pattern
  77. * @param objects
  78. */
  79. private static void error(Throwable t, Repository repository, String pattern, Object... objects) {
  80. List<Object> parameters = new ArrayList<Object>();
  81. if (objects != null && objects.length > 0) {
  82. for (Object o : objects) {
  83. parameters.add(o);
  84. }
  85. }
  86. if (repository != null) {
  87. parameters.add(0, repository.getDirectory().getAbsolutePath());
  88. }
  89. LOGGER.error(MessageFormat.format(pattern, parameters.toArray()), t);
  90. }
  91. /**
  92. * Returns a RefModel for the gb-pushes branch in the repository. If the
  93. * branch can not be found, null is returned.
  94. *
  95. * @param repository
  96. * @return a refmodel for the gb-pushes branch or null
  97. */
  98. public static RefModel getPushLogBranch(Repository repository) {
  99. List<RefModel> refs = JGitUtils.getRefs(repository, com.gitblit.Constants.R_GITBLIT);
  100. for (RefModel ref : refs) {
  101. if (ref.reference.getName().equals(GB_PUSHES)) {
  102. return ref;
  103. }
  104. }
  105. return null;
  106. }
  107. private static UserModel newUserModelFrom(PersonIdent ident) {
  108. String name = ident.getName();
  109. String username;
  110. String displayname;
  111. if (name.indexOf('/') > -1) {
  112. int slash = name.indexOf('/');
  113. displayname = name.substring(0, slash);
  114. username = name.substring(slash + 1);
  115. } else {
  116. displayname = name;
  117. username = ident.getEmailAddress();
  118. }
  119. UserModel user = new UserModel(username);
  120. user.displayName = displayname;
  121. user.emailAddress = ident.getEmailAddress();
  122. return user;
  123. }
  124. /**
  125. * Updates a push log.
  126. *
  127. * @param user
  128. * @param repository
  129. * @param commands
  130. * @return true, if the update was successful
  131. */
  132. public static boolean updatePushLog(UserModel user, Repository repository,
  133. Collection<ReceiveCommand> commands) {
  134. RefModel pushlogBranch = getPushLogBranch(repository);
  135. if (pushlogBranch == null) {
  136. JGitUtils.createOrphanBranch(repository, GB_PUSHES, null);
  137. }
  138. boolean success = false;
  139. String message = "push";
  140. try {
  141. ObjectId headId = repository.resolve(GB_PUSHES + "^{commit}");
  142. ObjectInserter odi = repository.newObjectInserter();
  143. try {
  144. // Create the in-memory index of the push log entry
  145. DirCache index = createIndex(repository, headId, commands);
  146. ObjectId indexTreeId = index.writeTree(odi);
  147. PersonIdent ident;
  148. if (UserModel.ANONYMOUS.equals(user)) {
  149. // anonymous push
  150. ident = new PersonIdent("anonymous", "anonymous");
  151. } else {
  152. // construct real pushing account
  153. ident = new PersonIdent(MessageFormat.format("{0}/{1}", user.getDisplayName(), user.username),
  154. user.emailAddress == null ? user.username : user.emailAddress);
  155. }
  156. // Create a commit object
  157. CommitBuilder commit = new CommitBuilder();
  158. commit.setAuthor(ident);
  159. commit.setCommitter(ident);
  160. commit.setEncoding(Constants.CHARACTER_ENCODING);
  161. commit.setMessage(message);
  162. commit.setParentId(headId);
  163. commit.setTreeId(indexTreeId);
  164. // Insert the commit into the repository
  165. ObjectId commitId = odi.insert(commit);
  166. odi.flush();
  167. RevWalk revWalk = new RevWalk(repository);
  168. try {
  169. RevCommit revCommit = revWalk.parseCommit(commitId);
  170. RefUpdate ru = repository.updateRef(GB_PUSHES);
  171. ru.setNewObjectId(commitId);
  172. ru.setExpectedOldObjectId(headId);
  173. ru.setRefLogMessage("commit: " + revCommit.getShortMessage(), false);
  174. Result rc = ru.forceUpdate();
  175. switch (rc) {
  176. case NEW:
  177. case FORCED:
  178. case FAST_FORWARD:
  179. success = true;
  180. break;
  181. case REJECTED:
  182. case LOCK_FAILURE:
  183. throw new ConcurrentRefUpdateException(JGitText.get().couldNotLockHEAD,
  184. ru.getRef(), rc);
  185. default:
  186. throw new JGitInternalException(MessageFormat.format(
  187. JGitText.get().updatingRefFailed, GB_PUSHES, commitId.toString(),
  188. rc));
  189. }
  190. } finally {
  191. revWalk.release();
  192. }
  193. } finally {
  194. odi.release();
  195. }
  196. } catch (Throwable t) {
  197. error(t, repository, "Failed to commit pushlog entry to {0}");
  198. }
  199. return success;
  200. }
  201. /**
  202. * Creates an in-memory index of the push log entry.
  203. *
  204. * @param repo
  205. * @param headId
  206. * @param commands
  207. * @return an in-memory index
  208. * @throws IOException
  209. */
  210. private static DirCache createIndex(Repository repo, ObjectId headId,
  211. Collection<ReceiveCommand> commands) throws IOException {
  212. DirCache inCoreIndex = DirCache.newInCore();
  213. DirCacheBuilder dcBuilder = inCoreIndex.builder();
  214. ObjectInserter inserter = repo.newObjectInserter();
  215. long now = System.currentTimeMillis();
  216. Set<String> ignorePaths = new TreeSet<String>();
  217. try {
  218. // add receive commands to the temporary index
  219. for (ReceiveCommand command : commands) {
  220. // use the ref names as the path names
  221. String path = command.getRefName();
  222. ignorePaths.add(path);
  223. StringBuilder change = new StringBuilder();
  224. change.append(command.getType().name()).append(' ');
  225. switch (command.getType()) {
  226. case CREATE:
  227. change.append(ObjectId.zeroId().getName());
  228. change.append(' ');
  229. change.append(command.getNewId().getName());
  230. break;
  231. case UPDATE:
  232. case UPDATE_NONFASTFORWARD:
  233. change.append(command.getOldId().getName());
  234. change.append(' ');
  235. change.append(command.getNewId().getName());
  236. break;
  237. case DELETE:
  238. change = null;
  239. break;
  240. }
  241. if (change == null) {
  242. // ref deleted
  243. continue;
  244. }
  245. String content = change.toString();
  246. // create an index entry for this attachment
  247. final DirCacheEntry dcEntry = new DirCacheEntry(path);
  248. dcEntry.setLength(content.length());
  249. dcEntry.setLastModified(now);
  250. dcEntry.setFileMode(FileMode.REGULAR_FILE);
  251. // insert object
  252. dcEntry.setObjectId(inserter.insert(Constants.OBJ_BLOB, content.getBytes("UTF-8")));
  253. // add to temporary in-core index
  254. dcBuilder.add(dcEntry);
  255. }
  256. // Traverse HEAD to add all other paths
  257. TreeWalk treeWalk = new TreeWalk(repo);
  258. int hIdx = -1;
  259. if (headId != null)
  260. hIdx = treeWalk.addTree(new RevWalk(repo).parseTree(headId));
  261. treeWalk.setRecursive(true);
  262. while (treeWalk.next()) {
  263. String path = treeWalk.getPathString();
  264. CanonicalTreeParser hTree = null;
  265. if (hIdx != -1)
  266. hTree = treeWalk.getTree(hIdx, CanonicalTreeParser.class);
  267. if (!ignorePaths.contains(path)) {
  268. // add entries from HEAD for all other paths
  269. if (hTree != null) {
  270. // create a new DirCacheEntry with data retrieved from
  271. // HEAD
  272. final DirCacheEntry dcEntry = new DirCacheEntry(path);
  273. dcEntry.setObjectId(hTree.getEntryObjectId());
  274. dcEntry.setFileMode(hTree.getEntryFileMode());
  275. // add to temporary in-core index
  276. dcBuilder.add(dcEntry);
  277. }
  278. }
  279. }
  280. // release the treewalk
  281. treeWalk.release();
  282. // finish temporary in-core index used for this commit
  283. dcBuilder.finish();
  284. } finally {
  285. inserter.release();
  286. }
  287. return inCoreIndex;
  288. }
  289. public static List<PushLogEntry> getPushLog(String repositoryName, Repository repository) {
  290. return getPushLog(repositoryName, repository, null, 0, -1);
  291. }
  292. public static List<PushLogEntry> getPushLog(String repositoryName, Repository repository, int maxCount) {
  293. return getPushLog(repositoryName, repository, null, 0, maxCount);
  294. }
  295. public static List<PushLogEntry> getPushLog(String repositoryName, Repository repository, int offset, int maxCount) {
  296. return getPushLog(repositoryName, repository, null, offset, maxCount);
  297. }
  298. public static List<PushLogEntry> getPushLog(String repositoryName, Repository repository, Date minimumDate) {
  299. return getPushLog(repositoryName, repository, minimumDate, 0, -1);
  300. }
  301. /**
  302. * Returns the list of push log entries as they were recorded by Gitblit.
  303. * Each PushLogEntry may represent multiple ref updates.
  304. *
  305. * @param repositoryName
  306. * @param repository
  307. * @param minimumDate
  308. * @param offset
  309. * @param maxCount
  310. * if < 0, all pushes are returned.
  311. * @return a list of push log entries
  312. */
  313. public static List<PushLogEntry> getPushLog(String repositoryName, Repository repository,
  314. Date minimumDate, int offset, int maxCount) {
  315. List<PushLogEntry> list = new ArrayList<PushLogEntry>();
  316. RefModel ref = getPushLogBranch(repository);
  317. if (ref == null) {
  318. return list;
  319. }
  320. if (maxCount == 0) {
  321. return list;
  322. }
  323. Map<ObjectId, List<RefModel>> allRefs = JGitUtils.getAllRefs(repository);
  324. List<RevCommit> pushes;
  325. if (minimumDate == null) {
  326. pushes = JGitUtils.getRevLog(repository, GB_PUSHES, offset, maxCount);
  327. } else {
  328. pushes = JGitUtils.getRevLog(repository, GB_PUSHES, minimumDate);
  329. }
  330. for (RevCommit push : pushes) {
  331. if (push.getAuthorIdent().getName().equalsIgnoreCase("gitblit")) {
  332. // skip gitblit/internal commits
  333. continue;
  334. }
  335. UserModel user = newUserModelFrom(push.getAuthorIdent());
  336. Date date = push.getAuthorIdent().getWhen();
  337. PushLogEntry log = new PushLogEntry(repositoryName, date, user);
  338. list.add(log);
  339. List<PathChangeModel> changedRefs = JGitUtils.getFilesInCommit(repository, push);
  340. for (PathChangeModel change : changedRefs) {
  341. switch (change.changeType) {
  342. case DELETE:
  343. log.updateRef(change.path, ReceiveCommand.Type.DELETE);
  344. break;
  345. case ADD:
  346. log.updateRef(change.path, ReceiveCommand.Type.CREATE);
  347. default:
  348. String content = JGitUtils.getStringContent(repository, push.getTree(), change.path);
  349. String [] fields = content.split(" ");
  350. String oldId = fields[1];
  351. String newId = fields[2];
  352. log.updateRef(change.path, ReceiveCommand.Type.valueOf(fields[0]), oldId, newId);
  353. List<RevCommit> pushedCommits = JGitUtils.getRevLog(repository, oldId, newId);
  354. for (RevCommit pushedCommit : pushedCommits) {
  355. RepositoryCommit repoCommit = log.addCommit(change.path, pushedCommit);
  356. if (repoCommit != null) {
  357. repoCommit.setRefs(allRefs.get(pushedCommit.getId()));
  358. }
  359. }
  360. }
  361. }
  362. }
  363. Collections.sort(list);
  364. return list;
  365. }
  366. /**
  367. * Returns the list of pushes separated by ref (e.g. each ref has it's own
  368. * PushLogEntry object).
  369. *
  370. * @param repositoryName
  371. * @param repository
  372. * @param maxCount
  373. * @return a list of push log entries separated by ref
  374. */
  375. public static List<PushLogEntry> getPushLogByRef(String repositoryName, Repository repository, int maxCount) {
  376. return getPushLogByRef(repositoryName, repository, 0, maxCount);
  377. }
  378. /**
  379. * Returns the list of pushes separated by ref (e.g. each ref has it's own
  380. * PushLogEntry object).
  381. *
  382. * @param repositoryName
  383. * @param repository
  384. * @param offset
  385. * @param maxCount
  386. * @return a list of push log entries separated by ref
  387. */
  388. public static List<PushLogEntry> getPushLogByRef(String repositoryName, Repository repository, int offset,
  389. int maxCount) {
  390. // break the push log into ref push logs and then merge them back into a list
  391. Map<String, List<PushLogEntry>> refMap = new HashMap<String, List<PushLogEntry>>();
  392. List<PushLogEntry> pushes = getPushLog(repositoryName, repository, offset, maxCount);
  393. for (PushLogEntry push : pushes) {
  394. for (String ref : push.getChangedRefs()) {
  395. if (!refMap.containsKey(ref)) {
  396. refMap.put(ref, new ArrayList<PushLogEntry>());
  397. }
  398. // construct new ref-specific push log entry
  399. PushLogEntry refPush;
  400. if (push instanceof DailyLogEntry) {
  401. // simulated push log from commits grouped by date
  402. refPush = new DailyLogEntry(push.repository, push.date);
  403. } else {
  404. // real push log entry
  405. refPush = new PushLogEntry(push.repository, push.date, push.user);
  406. }
  407. refPush.updateRef(ref, push.getChangeType(ref), push.getOldId(ref), push.getNewId(ref));
  408. refPush.addCommits(push.getCommits(ref));
  409. refMap.get(ref).add(refPush);
  410. }
  411. }
  412. // merge individual ref pushes into master list
  413. List<PushLogEntry> refPushLog = new ArrayList<PushLogEntry>();
  414. for (List<PushLogEntry> refPush : refMap.values()) {
  415. refPushLog.addAll(refPush);
  416. }
  417. // sort ref push log
  418. Collections.sort(refPushLog);
  419. return refPushLog;
  420. }
  421. /**
  422. * Returns the list of pushes separated by ref (e.g. each ref has it's own
  423. * PushLogEntry object).
  424. *
  425. * @param repositoryName
  426. * @param repository
  427. * @param minimumDate
  428. * @return a list of push log entries separated by ref
  429. */
  430. public static List<PushLogEntry> getPushLogByRef(String repositoryName, Repository repository, Date minimumDate) {
  431. // break the push log into ref push logs and then merge them back into a list
  432. Map<String, List<PushLogEntry>> refMap = new HashMap<String, List<PushLogEntry>>();
  433. List<PushLogEntry> pushes = getPushLog(repositoryName, repository, minimumDate);
  434. for (PushLogEntry push : pushes) {
  435. for (String ref : push.getChangedRefs()) {
  436. if (!refMap.containsKey(ref)) {
  437. refMap.put(ref, new ArrayList<PushLogEntry>());
  438. }
  439. // construct new ref-specific push log entry
  440. PushLogEntry refPush = new PushLogEntry(push.repository, push.date, push.user);
  441. refPush.updateRef(ref, push.getChangeType(ref), push.getOldId(ref), push.getNewId(ref));
  442. refPush.addCommits(push.getCommits(ref));
  443. refMap.get(ref).add(refPush);
  444. }
  445. }
  446. // merge individual ref pushes into master list
  447. List<PushLogEntry> refPushLog = new ArrayList<PushLogEntry>();
  448. for (List<PushLogEntry> refPush : refMap.values()) {
  449. refPushLog.addAll(refPush);
  450. }
  451. // sort ref push log
  452. Collections.sort(refPushLog);
  453. return refPushLog;
  454. }
  455. /**
  456. * Returns a commit log grouped by day.
  457. *
  458. * @param repositoryName
  459. * @param repository
  460. * @param minimumDate
  461. * @param offset
  462. * @param maxCount
  463. * if < 0, all pushes are returned.
  464. * @return a list of grouped commit log entries
  465. */
  466. public static List<DailyLogEntry> getDailyLog(String repositoryName, Repository repository,
  467. Date minimumDate, int offset, int maxCount) {
  468. DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
  469. // df.setTimeZone(timezone);
  470. Map<ObjectId, List<RefModel>> allRefs = JGitUtils.getAllRefs(repository);
  471. Map<String, DailyLogEntry> tags = new HashMap<String, DailyLogEntry>();
  472. Map<String, DailyLogEntry> dailydigests = new HashMap<String, DailyLogEntry>();
  473. for (RefModel local : JGitUtils.getLocalBranches(repository, true, -1)) {
  474. String branch = local.getName();
  475. List<RevCommit> commits = JGitUtils.getRevLog(repository, branch, minimumDate);
  476. for (RevCommit commit : commits) {
  477. Date date = JGitUtils.getCommitDate(commit);
  478. String dateStr = df.format(date);
  479. if (!dailydigests.containsKey(dateStr)) {
  480. dailydigests.put(dateStr, new DailyLogEntry(repositoryName, date));
  481. }
  482. PushLogEntry digest = dailydigests.get(dateStr);
  483. digest.updateRef(branch, ReceiveCommand.Type.UPDATE, commit.getParents()[0].getId().getName(), commit.getName());
  484. RepositoryCommit repoCommit = digest.addCommit(branch, commit);
  485. if (repoCommit != null) {
  486. repoCommit.setRefs(allRefs.get(commit.getId()));
  487. if (!ArrayUtils.isEmpty(repoCommit.getRefs())) {
  488. // treat tags as special events in the log
  489. for (RefModel ref : repoCommit.getRefs()) {
  490. if (ref.getName().startsWith(Constants.R_TAGS)) {
  491. if (!tags.containsKey(dateStr)) {
  492. UserModel tagUser = newUserModelFrom(commit.getAuthorIdent());
  493. Date tagDate = commit.getAuthorIdent().getWhen();
  494. tags.put(dateStr, new DailyLogEntry(repositoryName, tagDate, tagUser));
  495. }
  496. PushLogEntry tagEntry = tags.get(dateStr);
  497. tagEntry.updateRef(ref.getName(), ReceiveCommand.Type.CREATE);
  498. tagEntry.addCommits(Arrays.asList(repoCommit));
  499. }
  500. }
  501. }
  502. }
  503. }
  504. }
  505. List<DailyLogEntry> list = new ArrayList<DailyLogEntry>(dailydigests.values());
  506. list.addAll(tags.values());
  507. Collections.sort(list);
  508. return list;
  509. }
  510. /**
  511. * Returns the list of commits separated by ref (e.g. each ref has it's own
  512. * PushLogEntry object for each day).
  513. *
  514. * @param repositoryName
  515. * @param repository
  516. * @param minimumDate
  517. * @return a list of push log entries separated by ref and date
  518. */
  519. public static List<DailyLogEntry> getDailyLogByRef(String repositoryName, Repository repository, Date minimumDate) {
  520. // break the push log into ref push logs and then merge them back into a list
  521. Map<String, List<DailyLogEntry>> refMap = new HashMap<String, List<DailyLogEntry>>();
  522. List<DailyLogEntry> pushes = getDailyLog(repositoryName, repository, minimumDate, 0, -1);
  523. for (DailyLogEntry push : pushes) {
  524. for (String ref : push.getChangedRefs()) {
  525. if (!refMap.containsKey(ref)) {
  526. refMap.put(ref, new ArrayList<DailyLogEntry>());
  527. }
  528. // construct new ref-specific push log entry
  529. DailyLogEntry refPush = new DailyLogEntry(push.repository, push.date, push.user);
  530. refPush.updateRef(ref, push.getChangeType(ref), push.getOldId(ref), push.getNewId(ref));
  531. refPush.addCommits(push.getCommits(ref));
  532. refMap.get(ref).add(refPush);
  533. }
  534. }
  535. // merge individual ref pushes into master list
  536. List<DailyLogEntry> refPushLog = new ArrayList<DailyLogEntry>();
  537. for (List<DailyLogEntry> refPush : refMap.values()) {
  538. for (DailyLogEntry entry : refPush) {
  539. if (entry.getCommitCount() > 0) {
  540. refPushLog.add(entry);
  541. }
  542. }
  543. }
  544. // sort ref push log
  545. Collections.sort(refPushLog);
  546. return refPushLog;
  547. }
  548. }