Mercurial > public > mercurial-scm > python-hglib
comparison hglib/client.py @ 27:46908f4b87d5
client: add bookmarks support to incoming and outgoing
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Thu, 11 Aug 2011 22:59:05 +0300 |
parents | b4e5c8745ef3 |
children | 221eeb3693f4 |
comparison
equal
deleted
inserted
replaced
26:b4e5c8745ef3 | 27:46908f4b87d5 |
---|---|
306 self.rawcommand(args, prompt=prompt, input=input) | 306 self.rawcommand(args, prompt=prompt, input=input) |
307 | 307 |
308 def incoming(self, revrange=None, path=None, force=False, newest=False, | 308 def incoming(self, revrange=None, path=None, force=False, newest=False, |
309 bundle=None, bookmarks=False, branch=None, limit=None, | 309 bundle=None, bookmarks=False, branch=None, limit=None, |
310 nomerges=False, subrepos=False): | 310 nomerges=False, subrepos=False): |
311 """ | |
312 Return new changesets found in the specified path or the default pull | |
313 location. | |
314 | |
315 When bookmarks=True, return a list of (name, node) of incoming bookmarks. | |
316 """ | |
311 args = cmdbuilder('incoming', | 317 args = cmdbuilder('incoming', |
312 path, | 318 path, |
313 template=templates.changeset, r=revrange, | 319 template=templates.changeset, r=revrange, |
314 f=force, n=newest, bundle=bundle, | 320 f=force, n=newest, bundle=bundle, |
315 B=bookmarks, b=branch, l=limit, M=nomerges, S=subrepos) | 321 B=bookmarks, b=branch, l=limit, M=nomerges, S=subrepos) |
320 | 326 |
321 out = self.rawcommand(args, eh=eh) | 327 out = self.rawcommand(args, eh=eh) |
322 if not out: | 328 if not out: |
323 return [] | 329 return [] |
324 | 330 |
325 out = util.eatlines(out, 2).split('\0')[:-1] | 331 out = util.eatlines(out, 2) |
326 return self._parserevs(out) | 332 if bookmarks: |
333 bms = [] | |
334 for line in out.splitlines(): | |
335 bms.append(tuple(line.split())) | |
336 return bms | |
337 else: | |
338 out = out.split('\0')[:-1] | |
339 return self._parserevs(out) | |
327 | 340 |
328 def log(self, revrange=None, files=[], follow=False, followfirst=False, | 341 def log(self, revrange=None, files=[], follow=False, followfirst=False, |
329 date=None, copies=False, keyword=None, removed=False, onlymerges=False, | 342 date=None, copies=False, keyword=None, removed=False, onlymerges=False, |
330 user=None, branch=None, prune=None, hidden=False, limit=None, | 343 user=None, branch=None, prune=None, hidden=False, limit=None, |
331 nomerges=False, include=None, exclude=None): | 344 nomerges=False, include=None, exclude=None): |
341 return self._parserevs(out) | 354 return self._parserevs(out) |
342 | 355 |
343 def outgoing(self, revrange=None, path=None, force=False, newest=False, | 356 def outgoing(self, revrange=None, path=None, force=False, newest=False, |
344 bookmarks=False, branch=None, limit=None, nomerges=False, | 357 bookmarks=False, branch=None, limit=None, nomerges=False, |
345 subrepos=False): | 358 subrepos=False): |
359 """ | |
360 Return changesets not found in the specified path or the default push | |
361 location. | |
362 | |
363 When bookmarks=True, return a list of (name, node) of bookmarks that will | |
364 be pushed. | |
365 """ | |
346 args = cmdbuilder('outgoing', | 366 args = cmdbuilder('outgoing', |
347 path, | 367 path, |
348 template=templates.changeset, r=revrange, | 368 template=templates.changeset, r=revrange, |
349 f=force, n=newest, B=bookmarks, | 369 f=force, n=newest, B=bookmarks, |
350 b=branch, S=subrepos) | 370 b=branch, S=subrepos) |
355 | 375 |
356 out = self.rawcommand(args, eh=eh) | 376 out = self.rawcommand(args, eh=eh) |
357 if not out: | 377 if not out: |
358 return [] | 378 return [] |
359 | 379 |
360 out = util.eatlines(out, 2).split('\0')[:-1] | 380 out = util.eatlines(out, 2) |
361 return self._parserevs(out) | 381 if bookmarks: |
382 bms = [] | |
383 for line in out.splitlines(): | |
384 bms.append(tuple(line.split())) | |
385 return bms | |
386 else: | |
387 out = out.split('\0')[:-1] | |
388 return self._parserevs(out) | |
362 | 389 |
363 def parents(self, rev=None, file=None): | 390 def parents(self, rev=None, file=None): |
364 args = cmdbuilder('parents', file, template=templates.changeset, r=rev) | 391 args = cmdbuilder('parents', file, template=templates.changeset, r=rev) |
365 | 392 |
366 out = self.rawcommand(args) | 393 out = self.rawcommand(args) |