Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 249572 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/team/tests/CommitTemplateTest.java (+30 lines)
Lines 44-49 Link Here
44
44
45
	}
45
	}
46
46
47
	public void testTemplateNullKeyTrailingCharacters() {
48
		String template = "${task.status} - ${connector.task.prefix} ${task.key}: ${task.description}";
49
50
		String taskId = "12345678";
51
		TaskTask testTask = new TaskTask("no url", taskId, "summary");
52
		testTask.setTaskKey(null);
53
		testTask.setSummary("TestSummary");
54
55
		String commitComment = FocusedTeamUiPlugin.getDefault().getCommitTemplateManager().generateComment(testTask,
56
				template);
57
		assertTrue(commitComment.contains(testTask.getSummary()));
58
59
		assertTrue(commitComment.contains(":"));
60
	}
61
62
	public void testTemplateCollapseWhitespace() {
63
		String template = "${task.status} - ${connector.task.prefix} ${task.key} ${task.key} : ${task.description}";
64
65
		String taskId = "12345678";
66
		TaskTask testTask = new TaskTask("no url", taskId, "summary");
67
		testTask.setTaskKey(null);
68
		testTask.setSummary("TestSummary");
69
70
		String commitComment = FocusedTeamUiPlugin.getDefault().getCommitTemplateManager().generateComment(testTask,
71
				template);
72
		assertTrue(commitComment.contains(testTask.getSummary()));
73
74
		assertFalse(commitComment.contains("  "));
75
	}
76
47
	public void testRepositoryTaskCommentParsing() {
77
	public void testRepositoryTaskCommentParsing() {
48
		String template = FocusedTeamUiPlugin.getDefault().getPreferenceStore().getString(
78
		String template = FocusedTeamUiPlugin.getDefault().getPreferenceStore().getString(
49
				FocusedTeamUiPlugin.COMMIT_TEMPLATE);
79
				FocusedTeamUiPlugin.COMMIT_TEMPLATE);
(-)src/org/eclipse/mylyn/internal/team/ui/templates/CommitTemplateManager.java (-1 / +3 lines)
Lines 179-189 Link Here
179
				value = processKeyword(task, keyword);
179
				value = processKeyword(task, keyword);
180
			}
180
			}
181
181
182
			String trailingCharacters = segment.substring(brace + 1);
182
			if (value != null) {
183
			if (value != null) {
183
				evaluated.add(value);
184
				evaluated.add(value);
184
				evaluated.add(segment.substring(brace + 1));
185
				evaluated.add(trailingCharacters);
185
			} else if (!evaluated.isEmpty()) {
186
			} else if (!evaluated.isEmpty()) {
186
				evaluated.pop();
187
				evaluated.pop();
188
				evaluated.add(trailingCharacters);
187
			}
189
			}
188
//			else {
190
//			else {
189
//				buffer.append("${");
191
//				buffer.append("${");

Return to bug 249572