Mercurial > jhg
comparison 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 |
comparison
equal
deleted
inserted
replaced
684:2353e4217f59 | 685:9897cbfd2790 |
---|---|
240 // if fact, shall do other way round, this method shall send | 240 // if fact, shall do other way round, this method shall send |
241 LinkedHashMap<Range, List<Nodeid>> rv = new LinkedHashMap<HgRemoteRepository.Range, List<Nodeid>>(ranges.size() * 4 / 3); | 241 LinkedHashMap<Range, List<Nodeid>> rv = new LinkedHashMap<HgRemoteRepository.Range, List<Nodeid>>(ranges.size() * 4 / 3); |
242 StringBuilder sb = new StringBuilder(20 + ranges.size() * 82); | 242 StringBuilder sb = new StringBuilder(20 + ranges.size() * 82); |
243 sb.append("pairs="); | 243 sb.append("pairs="); |
244 for (Range r : ranges) { | 244 for (Range r : ranges) { |
245 sb.append(r.end.toString()); | 245 r.append(sb); |
246 sb.append('-'); | |
247 sb.append(r.start.toString()); | |
248 sb.append('+'); | 246 sb.append('+'); |
249 } | 247 } |
250 if (sb.charAt(sb.length() - 1) == '+') { | 248 if (sb.charAt(sb.length() - 1) == '+') { |
251 // strip last space | 249 // strip last space |
252 sb.setLength(sb.length() - 1); | 250 sb.setLength(sb.length() - 1); |
585 if (debug) { | 583 if (debug) { |
586 dumpResponseHeader(u, c); | 584 dumpResponseHeader(u, c); |
587 } | 585 } |
588 checkResponseOk(c, actionName, "listkeys"); | 586 checkResponseOk(c, actionName, "listkeys"); |
589 ArrayList<Pair<String, String>> rv = new ArrayList<Pair<String, String>>(); | 587 ArrayList<Pair<String, String>> rv = new ArrayList<Pair<String, String>>(); |
588 // output of listkeys is encoded with UTF-8 | |
590 BufferedReader r = new BufferedReader(new InputStreamReader(c.getInputStream(), EncodingHelper.getUTF8())); | 589 BufferedReader r = new BufferedReader(new InputStreamReader(c.getInputStream(), EncodingHelper.getUTF8())); |
591 String l; | 590 String l; |
592 while ((l = r.readLine()) != null) { | 591 while ((l = r.readLine()) != null) { |
593 int sep = l.indexOf('\t'); | 592 int sep = l.indexOf('\t'); |
594 if (sep == -1) { | 593 if (sep == -1) { |
722 */ | 721 */ |
723 public Range(Nodeid from, Nodeid to) { | 722 public Range(Nodeid from, Nodeid to) { |
724 start = from; | 723 start = from; |
725 end = to; | 724 end = to; |
726 } | 725 } |
726 | |
727 /** | |
728 * Append this range as pair of values 'end-start' to the supplied buffer and return the buffer. | |
729 */ | |
730 public StringBuilder append(StringBuilder sb) { | |
731 sb.append(end.toString()); | |
732 sb.append('-'); | |
733 sb.append(start.toString()); | |
734 return sb; | |
735 } | |
727 } | 736 } |
728 | 737 |
729 public static final class RemoteBranch { | 738 public static final class RemoteBranch { |
730 public final Nodeid head, root, p1, p2; | 739 public final Nodeid head, root, p1, p2; |
731 | 740 |