# HG changeset patch # User Matt Mackall # Date 1433972689 18000 # Node ID 9218f91619f6ad719b9b4eb5a0135d9c3f944923 # Parent 9a81657deec2d77ba3781b881a660955cb04562e topic: note when switching topics diff -r 9a81657deec2 -r 9218f91619f6 src/topic/__init__.py --- a/src/topic/__init__.py Wed Jun 10 16:32:20 2015 -0500 +++ b/src/topic/__init__.py Wed Jun 10 16:44:49 2015 -0500 @@ -131,6 +131,7 @@ def updatewrap(orig, ui, repo, *args, **kwargs): ret = orig(ui, repo, *args, **kwargs) pctx = repo['.'] + ot = repo.currenttopic if pctx.phase() == phases.public and repo.vfs.exists('topic'): repo.vfs.unlink('topic') else: @@ -139,6 +140,8 @@ if t and pctx.phase() > phases.public: with repo.vfs.open('topic', 'w') as f: f.write(t) + if t != ot: + ui.status(_("switching to topic %s\n") % t) return ret extensions.wrapcommand(commands.table, 'update', updatewrap) diff -r 9a81657deec2 -r 9218f91619f6 tests/test-topic.t --- a/tests/test-topic.t Wed Jun 10 16:32:20 2015 -0500 +++ b/tests/test-topic.t Wed Jun 10 16:44:49 2015 -0500 @@ -50,6 +50,7 @@ created new head $ hg co narf 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + switching to topic narf $ hg topic fran * narf @@ -215,6 +216,7 @@ $ cd ../pinky $ hg co query 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + switching to topic query $ echo answer >> alpha $ hg ci -m 'Narf is like `zort` or `poit`!' $ hg merge narf @@ -418,6 +420,7 @@ $ hg co fran 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + switching to topic fran $ hg topics * fran $ hg topics --clear