0c122b668079 — Kostia Balytskyi 8 years ago
smartlog: warn user when there is no master commit locally

Differential Revision: https://phabricator.fb.com/D2890713
2 files changed, 27 insertions(+), 0 deletions(-)

M smartlog.py
M tests/test-smartlog-remotenames.t
M smartlog.py +4 -0
@@ 460,6 460,10 @@ Excludes:
     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:

          
M tests/test-smartlog-remotenames.t +23 -0
@@ 84,3 84,26 @@ Test configuration of "interesting" book
   |/
   @  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)