diff src/org/tmatesoft/hg/repo/HgRemoteRepository.java @ 685:9897cbfd2790

Towards ssh remote repositories: use ganymed library for ssh transport
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 25 Jul 2013 21:32:09 +0200
parents 545b1d4cc11d
children 9859fcea475d
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRemoteRepository.java	Thu Jul 25 21:31:23 2013 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRemoteRepository.java	Thu Jul 25 21:32:09 2013 +0200
@@ -242,9 +242,7 @@
 		StringBuilder sb = new StringBuilder(20 + ranges.size() * 82);
 		sb.append("pairs=");
 		for (Range r : ranges) {
-			sb.append(r.end.toString());
-			sb.append('-');
-			sb.append(r.start.toString());
+			r.append(sb);
 			sb.append('+');
 		}
 		if (sb.charAt(sb.length() - 1) == '+') {
@@ -587,6 +585,7 @@
 			}
 			checkResponseOk(c, actionName, "listkeys");
 			ArrayList<Pair<String, String>> rv = new ArrayList<Pair<String, String>>();
+			// output of listkeys is encoded with UTF-8
 			BufferedReader r = new BufferedReader(new InputStreamReader(c.getInputStream(), EncodingHelper.getUTF8()));
 			String l;
 			while ((l = r.readLine()) != null) {
@@ -724,6 +723,16 @@
 			start = from;
 			end = to;
 		}
+		
+		/**
+		 * Append this range as pair of values 'end-start' to the supplied buffer and return the buffer.
+		 */
+		public StringBuilder append(StringBuilder sb) {
+			sb.append(end.toString());
+			sb.append('-');
+			sb.append(start.toString());
+			return sb;
+		}
 	}
 
 	public static final class RemoteBranch {