# HG changeset patch # User Kostia Balytskyi # Date 1454440528 28800 # Tue Feb 02 11:15:28 2016 -0800 # Node ID 0c122b6680795c0502987103ff9e3736bfb38e76 # Parent 6dd477f76ca35ae46e82972648735867cf335d3e smartlog: warn user when there is no master commit locally Differential Revision: https://phabricator.fb.com/D2890713 diff --git a/smartlog.py b/smartlog.py --- a/smartlog.py +++ b/smartlog.py @@ -460,6 +460,10 @@ global enabled try: enabled = True + if masterrevset == 'tip': + # 'tip' is what _masterrevset always returns when it can't find master or @ + ui.warn("warning: there is no master commit locally, try pulling from server\n") + revdag = getdag(ui, repo, revs, masterrev) displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) if 'repo' in inspect.getargspec(cmdutil.displaygraph).args: diff --git a/tests/test-smartlog-remotenames.t b/tests/test-smartlog-remotenames.t --- a/tests/test-smartlog-remotenames.t +++ b/tests/test-smartlog-remotenames.t @@ -84,3 +84,26 @@ |/ @ 0 mybook + +Change remote master to a non-existing locally commit and check that warning +is shown to the user + $ cat > .hg/remotenames << EOF + > 6dd477f76ca35ae46e82972648735867cf335d3e bookmarks remote/master + > EOF + $ hg sl + warning: there is no master commit locally, try pulling from server + o changeset: 3:8e2253d950ae + | tag: tip + | parent: 0:b292c1e3311f + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: x4 + | + @ changeset: 0:b292c1e3311f + bookmark: mybook + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: x + + note: hiding 3 old heads without bookmarks + (use --all to see them)