package com.perforce.common.label; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.perforce.common.depot.DepotConvert; import com.perforce.common.journal.BuildLabel; import com.perforce.common.process.ChangeInfo; import com.perforce.config.CFG; import com.perforce.config.Config; import com.perforce.config.ScmType; public class LabelConvert implements LabelInterface { private final DepotConvert depot; private final String name; private final ChangeInfo change; private String fromPath; private long fromRev; private boolean automatic = false; private ArrayList<String> views = new ArrayList<String>(); private List<TagConvert> revs = new ArrayList<TagConvert>(); @Override public void setFrom(String fromPath, long fromRev) { this.fromPath = fromPath; this.fromRev = fromRev; } @Override public String getFromPath() { return fromPath; } @Override public long getFromRev() { return fromRev; } public LabelConvert(String label, ChangeInfo change, DepotConvert depot) { this.depot = depot; this.name = label; this.change = change; } @Override public String getName() { return name; } @Override public String getOwner() { return depot.getUser(); } @Override public Long getDate() { Date date = change.getDate(); long time = date.getTime() / 1000; return time; } @Override public void setAutomatic(boolean auto) { this.automatic = auto; } @Override public boolean isAutomatic() { return this.automatic; } @Override public String getAutomatic() { if (automatic) { return "@" + getFromRev(); } return ""; } @Override public String getDesc() { StringBuffer sb = new StringBuffer(); sb.append("Created by p4convert. "); if (automatic) { sb.append("[Automatic Label]"); } else { sb.append("[Static Label]"); } return sb.toString(); } @Override public List<TagConvert> getTags() { return revs; } @Override public void add(TagConvert tag) { revs.add(tag); } @Override public void addView(String view) throws Exception { views.add(view); } @Override public ArrayList<String> getView() { return views; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append(name + " by: " + getOwner() + "\n"); int i = 0; for (String view : views) { sb.append(" view[" + i + "] " + view); i++; } for (TagConvert tags : revs) { sb.append("... " + tags + "\n"); } return sb.toString(); } @Override public void submit() throws Exception { ArrayList<String> journal = BuildLabel.toJournal(depot, this); depot.getJournal().write(journal); depot.getJournal().flush(); ScmType type = (ScmType) Config.get(CFG.SCM_TYPE); if (type == ScmType.SVN) { LabelHistory.add(this); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 12446 | Paul Allen | Branching using p4convert-rusty | ||
//guest/perforce_software/p4convert/src/com/perforce/common/label/LabelConvert.java | |||||
#8 | 11760 | Paul Allen |
Use default label description and append label type. Previously I used the change description, which is ok for Automatic labels, but Static labels may include more than one change. Includes: - Fix parsing of RCS descriptions (support descriptions without new line) - Update to test cases. |
||
#7 | 11298 | Paul Allen | Restrict label history to SVN + CONVERT mode | ||
#6 | 11294 | Paul Allen |
SVN: Improved label support for Subversion tag of another tag, when one or both get converted to a Perforce label. TODO: add aditional unit tests. |
||
#5 | 11043 | Paul Allen |
SVN: Added View support for Automatic labels (Convert and Import mode) - Update view metadata in test case 118 |
||
#4 | 11024 | Paul Allen | SVN: Minor fixes to automatic labels. | ||
#3 | 11018 | Paul Allen | SVN: Support automatic labels for IMPORT and CONVERT modes. | ||
#2 | 10730 | Paul Allen |
CVS: Fix for Labels in Import mode. Unable to label a revision in a pending change, so store all tag entries and add them to label after the change is submitted. Includes basic test case 030 |
||
#1 | 9807 | Paul Allen | Initial import of p4-convert (from change 894340) |