Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgRemoteRepository.java @ 202:706bcc7cfee4
Basic test for HgIncomingCommand. Fix RepositoryComparator for cases when whole repository is unknown. Respect freshly initialized (empty) repositories in general.
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 26 Apr 2011 02:50:06 +0200 |
parents | 9b99d27aeddc |
children | 66fd2c73c56f |
comparison
equal
deleted
inserted
replaced
201:a736f42ed75b | 202:706bcc7cfee4 |
---|---|
301 throw new HgException(ex); | 301 throw new HgException(ex); |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 /* | 305 /* |
306 * XXX need to describe behavior when roots arg is empty; our RepositoryComparator code currently returns empty lists when | |
307 * no common elements found, which in turn means we need to query changes starting with NULL nodeid. | |
308 * | |
306 * WireProtocol wiki: roots = a list of the latest nodes on every service side changeset branch that both the client and server know about. | 309 * WireProtocol wiki: roots = a list of the latest nodes on every service side changeset branch that both the client and server know about. |
307 * | 310 * |
308 * Perhaps, shall be named 'changegroup' | 311 * Perhaps, shall be named 'changegroup' |
309 | 312 |
310 * Changegroup: | 313 * Changegroup: |
314 * according to latter, bundleformat data is sent through zlib | 317 * according to latter, bundleformat data is sent through zlib |
315 * (there's no header like HG10?? with the server output, though, | 318 * (there's no header like HG10?? with the server output, though, |
316 * as one may expect according to http://mercurial.selenic.com/wiki/BundleFormat) | 319 * as one may expect according to http://mercurial.selenic.com/wiki/BundleFormat) |
317 */ | 320 */ |
318 public HgBundle getChanges(List<Nodeid> roots) throws HgException { | 321 public HgBundle getChanges(List<Nodeid> roots) throws HgException { |
319 StringBuilder sb = new StringBuilder(20 + roots.size() * 41); | 322 List<Nodeid> _roots = roots.isEmpty() ? Collections.singletonList(Nodeid.NULL) : roots; |
323 StringBuilder sb = new StringBuilder(20 + _roots.size() * 41); | |
320 sb.append("roots="); | 324 sb.append("roots="); |
321 for (Nodeid n : roots) { | 325 for (Nodeid n : _roots) { |
322 sb.append(n.toString()); | 326 sb.append(n.toString()); |
323 sb.append('+'); | 327 sb.append('+'); |
324 } | 328 } |
325 if (sb.charAt(sb.length() - 1) == '+') { | 329 if (sb.charAt(sb.length() - 1) == '+') { |
326 // strip last space | 330 // strip last space |