diff test/org/tmatesoft/hg/tools/ChangelogEntryBuilder.java @ 386:73e875154afb

Do not fail with empty extras string in changeset
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 13 Feb 2012 14:52:21 +0100
parents 4b97847d0b2d
children
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/tools/ChangelogEntryBuilder.java	Mon Feb 13 14:19:36 2012 +0100
+++ b/test/org/tmatesoft/hg/tools/ChangelogEntryBuilder.java	Mon Feb 13 14:52:21 2012 +0100
@@ -67,7 +67,7 @@
 	}
 	
 	public ChangelogEntryBuilder branch(String branchName) {
-		if (branchName == null) {
+		if (branchName == null || "default".equals(branchName)) {
 			extrasMap.remove("branch");
 		} else {
 			extrasMap.put("branch", branchName);
@@ -114,15 +114,17 @@
 			}
 		}
 		StringBuilder files = new StringBuilder();
-		for (Iterator<String> it = modifiedFiles.iterator(); it.hasNext(); ) {
-			files.append(it.next());
-			if (it.hasNext()) {
-				files.append('\n');
+		if (modifiedFiles != null) {
+			for (Iterator<String> it = modifiedFiles.iterator(); it.hasNext(); ) {
+				files.append(it.next());
+				if (it.hasNext()) {
+					files.append('\n');
+				}
 			}
 		}
 		final long date = csetTime();
 		final int tz = csetTimezone(date);
-		return String.format(f, manifestRevision.toString(), user, date, tz, extras, files, comment).getBytes();
+		return String.format(f, manifestRevision.toString(), user(), date, tz, extras, files, comment).getBytes();
 	}
 
 	private final static CharSequence encodeExtrasPair(String s) {