Mercurial > evolve
comparison hgext3rd/topic/__init__.py @ 2869:b629874ccaac
topics: allow use a --current when setting a topic
This patch allow to use the current flag which can be used by user set existing
revs to the current topic.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 28 Aug 2017 17:16:16 +0200 |
parents | e46b68547017 |
children | 31cbace4c0f1 |
comparison
equal
deleted
inserted
replaced
2868:e46b68547017 | 2869:b629874ccaac |
---|---|
336 List of topics with their last touched time sorted according to it: | 336 List of topics with their last touched time sorted according to it: |
337 `hg topic --age` | 337 `hg topic --age` |
338 | 338 |
339 The active topic (if any) will be prepended with a "*". | 339 The active topic (if any) will be prepended with a "*". |
340 | 340 |
341 The `--current` flag helps to take active topic into account. For | |
342 example, if you want to set the topic on all the draft changesets to the | |
343 active topic, you can do: | |
344 `hg topic -r "draft()" --current` | |
345 | |
341 The --verbose version of this command display various information on the state of each topic.""" | 346 The --verbose version of this command display various information on the state of each topic.""" |
342 | 347 |
343 current = opts.get('current') | 348 current = opts.get('current') |
344 if current and topic: | 349 if current and topic: |
345 raise error.Abort(_("cannot use --current when setting a topic")) | 350 raise error.Abort(_("cannot use --current when setting a topic")) |
360 if rev: | 365 if rev: |
361 if not obsolete.isenabled(repo, obsolete.createmarkersopt): | 366 if not obsolete.isenabled(repo, obsolete.createmarkersopt): |
362 raise error.Abort(_('must have obsolete enabled to change topics')) | 367 raise error.Abort(_('must have obsolete enabled to change topics')) |
363 if clear: | 368 if clear: |
364 topic = None | 369 topic = None |
370 elif opts.get('current'): | |
371 topic = repo.currenttopic | |
365 elif not topic: | 372 elif not topic: |
366 raise error.Abort('changing topic requires a topic name or --clear') | 373 raise error.Abort('changing topic requires a topic name or --clear') |
367 if any(not c.mutable() for c in repo.set('%r and public()', rev)): | 374 if any(not c.mutable() for c in repo.set('%r and public()', rev)): |
368 raise error.Abort("can't change topic of a public change") | 375 raise error.Abort("can't change topic of a public change") |
369 wl = l = txn = None | 376 wl = l = txn = None |