annotate src/org/tmatesoft/hg/internal/ChangelogEntryBuilder.java @ 608:e1b29756f901

Clean, organize and resolve some TODOs and FIXMEs: minor refactorings and comments
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 07 May 2013 21:27:51 +0200
parents dd4f6311af52
children 7c0d2ce340b8
rev   line source
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2012 TMate Software Ltd
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
538
dd4f6311af52 Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 386
diff changeset
17 package org.tmatesoft.hg.internal;
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import java.util.ArrayList;
538
dd4f6311af52 Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 386
diff changeset
20 import java.util.Collection;
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
21 import java.util.Collections;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
22 import java.util.Iterator;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23 import java.util.LinkedHashMap;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 import java.util.List;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
25 import java.util.Map;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
26 import java.util.TimeZone;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 import java.util.Map.Entry;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
28
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
29 import org.tmatesoft.hg.core.Nodeid;
538
dd4f6311af52 Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 386
diff changeset
30 import org.tmatesoft.hg.util.Path;
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 /**
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 *
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34 * @author Artem Tikhomirov
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 * @author TMate Software Ltd.
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36 */
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37 public class ChangelogEntryBuilder {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39 private String user;
538
dd4f6311af52 Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 386
diff changeset
40 private List<Path> modifiedFiles;
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41 private final Map<String, String> extrasMap = new LinkedHashMap<String, String>();
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 private Integer tzOffset;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
43 private Long csetTime;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
44
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
45 public ChangelogEntryBuilder user(String username) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 user = username;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
47 return this;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
49
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
50 public String user() {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
51 if (user == null) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
52 // for our testing purposes anything but null is ok. no reason to follow Hg username lookup conventions
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
53 user = System.getProperty("user.name");
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
54 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
55 return user;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
56 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
57
538
dd4f6311af52 Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 386
diff changeset
58 public ChangelogEntryBuilder setModified(Collection<Path> files) {
dd4f6311af52 Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 386
diff changeset
59 modifiedFiles = new ArrayList<Path>(files == null ? Collections.<Path>emptyList() : files);
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
60 return this;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
61 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
62
538
dd4f6311af52 Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 386
diff changeset
63 public ChangelogEntryBuilder addModified(Collection<Path> files) {
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
64 if (modifiedFiles == null) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
65 return setModified(files);
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
66 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
67 modifiedFiles.addAll(files);
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
68 return this;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
69 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
70
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
71 public ChangelogEntryBuilder branch(String branchName) {
386
73e875154afb Do not fail with empty extras string in changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 384
diff changeset
72 if (branchName == null || "default".equals(branchName)) {
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
73 extrasMap.remove("branch");
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
74 } else {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
75 extrasMap.put("branch", branchName);
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
76 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
77 return this;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
78 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
79
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
80 public ChangelogEntryBuilder extras(Map<String, String> extras) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
81 extrasMap.clear();
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
82 extrasMap.putAll(extras);
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
83 return this;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
84 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
85
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
86 public ChangelogEntryBuilder date(long seconds, int timezoneOffset) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
87 csetTime = seconds;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
88 tzOffset = timezoneOffset;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
89 return this;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
90 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
91
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
92 private long csetTime() {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
93 if (csetTime != null) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
94 return csetTime;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
95 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
96 return System.currentTimeMillis() / 1000;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
97 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
98
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
99 private int csetTimezone(long time) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
100 if (tzOffset != null) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
101 return tzOffset;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
102 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
103 return -(TimeZone.getDefault().getOffset(time) / 1000);
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
104 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
105
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
106 public byte[] build(Nodeid manifestRevision, String comment) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
107 String f = "%s\n%s\n%d %d %s\n%s\n\n%s";
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
108 StringBuilder extras = new StringBuilder();
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
109 for (Iterator<Entry<String, String>> it = extrasMap.entrySet().iterator(); it.hasNext();) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
110 final Entry<String, String> next = it.next();
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
111 extras.append(encodeExtrasPair(next.getKey()));
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
112 extras.append(':');
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
113 extras.append(encodeExtrasPair(next.getValue()));
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
114 if (it.hasNext()) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
115 extras.append('\00');
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
116 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
117 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
118 StringBuilder files = new StringBuilder();
386
73e875154afb Do not fail with empty extras string in changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 384
diff changeset
119 if (modifiedFiles != null) {
538
dd4f6311af52 Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 386
diff changeset
120 for (Iterator<Path> it = modifiedFiles.iterator(); it.hasNext(); ) {
386
73e875154afb Do not fail with empty extras string in changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 384
diff changeset
121 files.append(it.next());
73e875154afb Do not fail with empty extras string in changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 384
diff changeset
122 if (it.hasNext()) {
73e875154afb Do not fail with empty extras string in changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 384
diff changeset
123 files.append('\n');
73e875154afb Do not fail with empty extras string in changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 384
diff changeset
124 }
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
125 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
126 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
127 final long date = csetTime();
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
128 final int tz = csetTimezone(date);
386
73e875154afb Do not fail with empty extras string in changeset
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 384
diff changeset
129 return String.format(f, manifestRevision.toString(), user(), date, tz, extras, files, comment).getBytes();
384
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
130 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
131
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
132 private final static CharSequence encodeExtrasPair(String s) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
133 if (s != null) {
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
134 return s.replace("\\", "\\\\").replace("\n", "\\n").replace("\r", "\\r").replace("\00", "\\0");
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
135 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
136 return s;
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
137 }
4b97847d0b2d Auxilary builders for manifest and changelog to create test repositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
138 }