1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.internal.storage.file;
12
13 import org.eclipse.jgit.lib.CheckoutEntry;
14 import org.eclipse.jgit.lib.ReflogEntry;
15
16
17
18
19 public class CheckoutEntryImpl implements CheckoutEntry {
20 static final String CHECKOUT_MOVING_FROM = "checkout: moving from ";
21
22 private String from;
23
24 private String to;
25
26 CheckoutEntryImpl(ReflogEntry reflogEntry) {
27 String comment = reflogEntry.getComment();
28 int p1 = CHECKOUT_MOVING_FROM.length();
29 int p2 = comment.indexOf(" to ", p1);
30 int p3 = comment.length();
31 from = comment.substring(p1,p2);
32 to = comment.substring(p2 + " to ".length(), p3);
33 }
34
35
36 @Override
37 public String getFromBranch() {
38 return from;
39 }
40
41
42 @Override
43 public String getToBranch() {
44 return to;
45 }
46 }