D6449: help: clarify overlap of revlog header and first revlog entry

2019-05-31 Thread ngoldbaum (Nathan Goldbaum)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbfd65b5e070b: help: clarify overlap of revlog header and 
first revlog entry (authored by ngoldbaum, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6449?vs=15277=15310

REVISION DETAIL
  https://phab.mercurial-scm.org/D6449

AFFECTED FILES
  mercurial/help/internals/revlogs.txt

CHANGE DETAILS

diff --git a/mercurial/help/internals/revlogs.txt 
b/mercurial/help/internals/revlogs.txt
--- a/mercurial/help/internals/revlogs.txt
+++ b/mercurial/help/internals/revlogs.txt
@@ -28,8 +28,8 @@
 ===
 
 A revlog begins with a 32-bit big endian integer holding version info
-and feature flags. This integer is shared with the first revision
-entry.
+and feature flags. This integer overlaps with the first four bytes of
+the first revision entry.
 
 This integer is logically divided into 2 16-bit shorts. The least
 significant half of the integer is the format/version short. The other
@@ -78,10 +78,10 @@
 00 03 00 01
v1 + inline + generaldelta
 
-Following the 32-bit header is the remainder of the first index entry.
-Following that are remaining *index* data. Inlined revision data is
-possibly located between index entries. More on this layout is described
-below.
+Following the 32-bit header is the remaining 60 bytes of the first index
+entry. Following that are additional *index* entries. Inlined revision
+data is possibly located between index entries. More on the this inlined
+layout is described below.
 
 Version 1 Format
 
@@ -149,8 +149,12 @@
 separate byte container. The offsets from bytes 0-5 and the compressed
 length from bytes 8-11 define how to access this data.
 
-The first 4 bytes of the revlog are shared between the revlog header
-and the 6 byte absolute offset field from the first revlog entry.
+The 6 byte absolute offset field from the first revlog entry overlaps
+with the revlog header. That is, the first 6 bytes of the first revlog
+entry can be split into four bytes containing the header for the revlog
+file and an additional two bytes containing the offset for the first
+entry. Since this is the offset from the beginning of the file for the
+first revision entry, the two bytes will always be set to zero.
 
 Version 2 Format
 



To: ngoldbaum, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6442: help: include subtopic in error message if passed

2019-05-29 Thread ngoldbaum (Nathan Goldbaum)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGad55a0a5894f: help: include subtopic in error message if 
passed (authored by ngoldbaum, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6442?vs=15269=15294

REVISION DETAIL
  https://phab.mercurial-scm.org/D6442

AFFECTED FILES
  mercurial/help.py
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1303,6 +1303,13 @@
   *empty chunk* at the end of each *delta group* denotes the boundary to 
the
   next filelog sub-segment.
 
+non-existent subtopics print an error
+
+  $ hg help internals.foo
+  abort: no such help topic: internals.foo
+  (try 'hg help --keyword foo')
+  [255]
+
 test advanced, deprecated and experimental options are hidden in command help
   $ hg help debugoptADV
   hg debugoptADV
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -453,7 +453,7 @@
 addtopichook('config', inserttweakrc)
 
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
-  **opts):
+  fullname=None, **opts):
 '''
 Generate the help for 'name' as unformatted restructured text. If
 'name' is None, describe the commands available.
@@ -814,8 +814,16 @@
 if unknowncmd:
 raise error.UnknownCommand(name)
 else:
-msg = _('no such help topic: %s') % name
-hint = _("try 'hg help --keyword %s'") % name
+if fullname:
+formatname = fullname
+else:
+formatname = name
+if subtopic:
+hintname = subtopic
+else:
+hintname = name
+msg = _('no such help topic: %s') % formatname
+hint = _("try 'hg help --keyword %s'") % hintname
 raise error.Abort(msg, hint=hint)
 else:
 # program name
@@ -850,7 +858,7 @@
 termwidth = ui.termwidth() - 2
 if textwidth <= 0 or termwidth < textwidth:
 textwidth = termwidth
-text = help_(ui, commands, name,
+text = help_(ui, commands, name, fullname=fullname,
  subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
 
 blocks, pruned = minirst.parse(text, keep=keep)



To: ngoldbaum, #hg-reviewers, pulkit
Cc: av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6441: help: check if a subtopic exists and raise an error if it doesn't (issue6145)

2019-05-29 Thread ngoldbaum (Nathan Goldbaum)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa84564b1a0b1: help: check if a subtopic exists and raise an 
error if it doesnt (issue6145) (authored by ngoldbaum, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6441?vs=15268=15293

REVISION DETAIL
  https://phab.mercurial-scm.org/D6441

AFFECTED FILES
  mercurial/help.py

CHANGE DETAILS

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -689,6 +689,8 @@
 for names, header, doc in subtopics[name]:
 if subtopic in names:
 break
+if not any(subtopic in s[0] for s in subtopics[name]):
+raise error.UnknownCommand(name)
 
 if not header:
 for topic in helptable:



To: ngoldbaum, #hg-reviewers, martinvonz, pulkit
Cc: pulkit, martinvonz, av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6449: help: clarify overlap of revlog header and first revlog entry

2019-05-28 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6449

AFFECTED FILES
  mercurial/help/internals/revlogs.txt

CHANGE DETAILS

diff --git a/mercurial/help/internals/revlogs.txt 
b/mercurial/help/internals/revlogs.txt
--- a/mercurial/help/internals/revlogs.txt
+++ b/mercurial/help/internals/revlogs.txt
@@ -28,8 +28,8 @@
 ===
 
 A revlog begins with a 32-bit big endian integer holding version info
-and feature flags. This integer is shared with the first revision
-entry.
+and feature flags. This integer overlaps with the first four bytes of
+the first revision entry.
 
 This integer is logically divided into 2 16-bit shorts. The least
 significant half of the integer is the format/version short. The other
@@ -78,10 +78,10 @@
 00 03 00 01
v1 + inline + generaldelta
 
-Following the 32-bit header is the remainder of the first index entry.
-Following that are remaining *index* data. Inlined revision data is
-possibly located between index entries. More on this layout is described
-below.
+Following the 32-bit header is the remaining 60 bytes of the first index
+entry. Following that are additional *index* entries. Inlined revision
+data is possibly located between index entries. More on the this inlined
+layout is described below.
 
 Version 1 Format
 
@@ -149,8 +149,12 @@
 separate byte container. The offsets from bytes 0-5 and the compressed
 length from bytes 8-11 define how to access this data.
 
-The first 4 bytes of the revlog are shared between the revlog header
-and the 6 byte absolute offset field from the first revlog entry.
+The 6 byte absolute offset field from the first revlog entry overlaps
+with the revlog header. That is, the first 6 bytes of the first revlog
+entry can be split into four bytes containing the header for the revlog
+file and an additional two bytes containing the offset for the first
+entry. Since this is the offset from the beginning of the file for the
+first revision entry, the two bytes will always be set to zero.
 
 Version 2 Format
 



To: ngoldbaum, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6442: help: include subtopic in error message if passed

2019-05-26 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum updated this revision to Diff 15269.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6442?vs=15259=15269

REVISION DETAIL
  https://phab.mercurial-scm.org/D6442

AFFECTED FILES
  mercurial/help.py
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1303,6 +1303,13 @@
   *empty chunk* at the end of each *delta group* denotes the boundary to 
the
   next filelog sub-segment.
 
+non-existent subtopics print an error
+
+  $ hg help internals.foo
+  abort: no such help topic: internals.foo
+  (try 'hg help --keyword foo')
+  [255]
+
 test advanced, deprecated and experimental options are hidden in command help
   $ hg help debugoptADV
   hg debugoptADV
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -453,7 +453,7 @@
 addtopichook('config', inserttweakrc)
 
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
-  **opts):
+  fullname=None, **opts):
 '''
 Generate the help for 'name' as unformatted restructured text. If
 'name' is None, describe the commands available.
@@ -814,8 +814,16 @@
 if unknowncmd:
 raise error.UnknownCommand(name)
 else:
-msg = _('no such help topic: %s') % name
-hint = _("try 'hg help --keyword %s'") % name
+if fullname:
+formatname = fullname
+else:
+formatname = name
+if subtopic:
+hintname = subtopic
+else:
+hintname = name
+msg = _('no such help topic: %s') % formatname
+hint = _("try 'hg help --keyword %s'") % hintname
 raise error.Abort(msg, hint=hint)
 else:
 # program name
@@ -850,7 +858,7 @@
 termwidth = ui.termwidth() - 2
 if textwidth <= 0 or termwidth < textwidth:
 textwidth = termwidth
-text = help_(ui, commands, name,
+text = help_(ui, commands, name, fullname=fullname,
  subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
 
 blocks, pruned = minirst.parse(text, keep=keep)



To: ngoldbaum, #hg-reviewers
Cc: av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6441: help: check if a subtopic exists and raise an error if it doesn't (issue6145)

2019-05-26 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum updated this revision to Diff 15268.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6441?vs=15258=15268

REVISION DETAIL
  https://phab.mercurial-scm.org/D6441

AFFECTED FILES
  mercurial/help.py

CHANGE DETAILS

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -689,6 +689,8 @@
 for names, header, doc in subtopics[name]:
 if subtopic in names:
 break
+if not any(subtopic in s[0] for s in subtopics[name]):
+raise error.UnknownCommand(name)
 
 if not header:
 for topic in helptable:



To: ngoldbaum, #hg-reviewers, martinvonz
Cc: pulkit, martinvonz, av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6441: help: check if a subtopic exists and raise an error if it doesn't (issue6145)

2019-05-25 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum added inline comments.

INLINE COMMENTS

> martinvonz wrote in help.py:689-695
> I avoid for-else for the same reason, but how about this:
> 
>   if not any(subtopic in names for names, header, doc in subtopics[name]):
>   raise error.UnknownCommand(name)

OK, I agree that's clearer. I used `_` to match `header` and `doc` to make the 
line a bit shorter and to make it a bit clearer for me to read since those 
aren't being used.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6441

To: ngoldbaum, #hg-reviewers, martinvonz
Cc: martinvonz, av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6442: help: include subtopic in error message if passed

2019-05-25 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum updated this revision to Diff 15259.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6442?vs=15253=15259

REVISION DETAIL
  https://phab.mercurial-scm.org/D6442

AFFECTED FILES
  mercurial/help.py
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1303,6 +1303,13 @@
   *empty chunk* at the end of each *delta group* denotes the boundary to 
the
   next filelog sub-segment.
 
+non-existent subtopics print an error
+
+  $ hg help internals.foo
+  abort: no such help topic: internals.foo
+  (try 'hg help --keyword foo')
+  [255]
+
 test advanced, deprecated and experimental options are hidden in command help
   $ hg help debugoptADV
   hg debugoptADV
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -453,7 +453,7 @@
 addtopichook('config', inserttweakrc)
 
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
-  **opts):
+  fullname=None, **opts):
 '''
 Generate the help for 'name' as unformatted restructured text. If
 'name' is None, describe the commands available.
@@ -814,8 +814,16 @@
 if unknowncmd:
 raise error.UnknownCommand(name)
 else:
-msg = _('no such help topic: %s') % name
-hint = _("try 'hg help --keyword %s'") % name
+if fullname:
+formatname = fullname
+else:
+formatname = name
+if subtopic:
+hintname = subtopic
+else:
+hintname = name
+msg = _('no such help topic: %s') % formatname
+hint = _("try 'hg help --keyword %s'") % hintname
 raise error.Abort(msg, hint=hint)
 else:
 # program name
@@ -850,7 +858,7 @@
 termwidth = ui.termwidth() - 2
 if textwidth <= 0 or termwidth < textwidth:
 textwidth = termwidth
-text = help_(ui, commands, name,
+text = help_(ui, commands, name, fullname=fullname,
  subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
 
 blocks, pruned = minirst.parse(text, keep=keep)



To: ngoldbaum, #hg-reviewers
Cc: av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6441: help: check if a subtopic exists and raise an error if it doesn't (issue6145)

2019-05-25 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum updated this revision to Diff 15258.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6441?vs=15246=15258

REVISION DETAIL
  https://phab.mercurial-scm.org/D6441

AFFECTED FILES
  mercurial/help.py

CHANGE DETAILS

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -689,6 +689,8 @@
 for names, header, doc in subtopics[name]:
 if subtopic in names:
 break
+if not any(subtopic in names for names, _, _ in subtopics[name]):
+raise error.UnknownCommand(name)
 
 if not header:
 for topic in helptable:



To: ngoldbaum, #hg-reviewers, martinvonz
Cc: martinvonz, av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6441: help: check if a subtopic exists and raise an error if it doesn't (issue6145)

2019-05-24 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum added inline comments.

INLINE COMMENTS

> av6 wrote in help.py:689-695
> This made me remember that for-else statement exists.

I left this as-is because I find for-else statements hard to read (I never 
remember what it means!) and find this to be clearer even if there's a bit more 
boilerplate.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6441

To: ngoldbaum, #hg-reviewers
Cc: av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6442: help: include subtopic in error message if passed

2019-05-24 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum updated this revision to Diff 15253.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6442?vs=15247=15253

REVISION DETAIL
  https://phab.mercurial-scm.org/D6442

AFFECTED FILES
  mercurial/help.py
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1303,6 +1303,13 @@
   *empty chunk* at the end of each *delta group* denotes the boundary to 
the
   next filelog sub-segment.
 
+non-existent subtopics print an error
+
+  $ hg help internals.foo
+  abort: no such help topic: internals.foo
+  (try 'hg help --keyword foo')
+  [255]
+
 test advanced, deprecated and experimental options are hidden in command help
   $ hg help debugoptADV
   hg debugoptADV
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -453,7 +453,7 @@
 addtopichook('config', inserttweakrc)
 
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
-  **opts):
+  fullname=None, **opts):
 '''
 Generate the help for 'name' as unformatted restructured text. If
 'name' is None, describe the commands available.
@@ -816,8 +816,16 @@
 if unknowncmd:
 raise error.UnknownCommand(name)
 else:
-msg = _('no such help topic: %s') % name
-hint = _("try 'hg help --keyword %s'") % name
+if fullname:
+formatname = fullname
+else:
+formatname = name
+if subtopic:
+hintname = subtopic
+else:
+hintname = name
+msg = _('no such help topic: %s') % formatname
+hint = _("try 'hg help --keyword %s'") % hintname
 raise error.Abort(msg, hint=hint)
 else:
 # program name
@@ -852,7 +860,7 @@
 termwidth = ui.termwidth() - 2
 if textwidth <= 0 or termwidth < textwidth:
 textwidth = termwidth
-text = help_(ui, commands, name,
+text = help_(ui, commands, name, fullname=fullname,
  subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
 
 blocks, pruned = minirst.parse(text, keep=keep)



To: ngoldbaum, #hg-reviewers
Cc: av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6442: help: include subtopic in error message if passed

2019-05-24 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum added inline comments.

INLINE COMMENTS

> av6 wrote in help.py:826
> Concatenating things is not the best option when it comes to i18n, but even 
> if it were, I think it would make sense to only show here the subtopic, if 
> it's provided. If people are curious about internals.foobar (or 
> config.foobar), then `hg help -k foobar` helps way more than `hg help -k 
> internals`. And we already make sure that the topic that comes before the dot 
> exists, right?

Fair enough, I agree just the subtopic is fine.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6442

To: ngoldbaum, #hg-reviewers
Cc: av6, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6442: help: include subtopic in error message if passed

2019-05-23 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6442

AFFECTED FILES
  mercurial/help.py
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1303,6 +1303,13 @@
   *empty chunk* at the end of each *delta group* denotes the boundary to 
the
   next filelog sub-segment.
 
+non-existent subtopics print an error
+
+  $ hg help internals.foo
+  abort: no such help topic: internals.foo
+  (try 'hg help --keyword internals' or 'hg help --keyword foo')
+  [255]
+
 test advanced, deprecated and experimental options are hidden in command help
   $ hg help debugoptADV
   hg debugoptADV
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -453,7 +453,7 @@
 addtopichook('config', inserttweakrc)
 
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
-  **opts):
+  fullname=None, **opts):
 '''
 Generate the help for 'name' as unformatted restructured text. If
 'name' is None, describe the commands available.
@@ -816,8 +816,14 @@
 if unknowncmd:
 raise error.UnknownCommand(name)
 else:
-msg = _('no such help topic: %s') % name
+if fullname:
+formatname = fullname
+else:
+formatname = name
+msg = _('no such help topic: %s') % formatname
 hint = _("try 'hg help --keyword %s'") % name
+if subtopic:
+hint += _(" or 'hg help --keyword %s'") % subtopic
 raise error.Abort(msg, hint=hint)
 else:
 # program name
@@ -852,7 +858,7 @@
 termwidth = ui.termwidth() - 2
 if textwidth <= 0 or termwidth < textwidth:
 textwidth = termwidth
-text = help_(ui, commands, name,
+text = help_(ui, commands, name, fullname=fullname,
  subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
 
 blocks, pruned = minirst.parse(text, keep=keep)



To: ngoldbaum, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6441: help: check if a subtopic exists and raise an error if it doesn't (issue6145)

2019-05-23 Thread ngoldbaum (Nathan Goldbaum)
ngoldbaum created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6441

AFFECTED FILES
  mercurial/help.py

CHANGE DETAILS

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -686,9 +686,13 @@
 # Look for sub-topic entry first.
 header, doc = None, None
 if subtopic and name in subtopics:
+exists = False
 for names, header, doc in subtopics[name]:
 if subtopic in names:
+exists = True
 break
+if not exists:
+raise error.UnknownCommand(name)
 
 if not header:
 for topic in helptable:



To: ngoldbaum, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH STABLE] log: mention ui.logtemplate in the help text

2017-08-16 Thread Nathan Goldbaum
# HG changeset patch
# User Nathan Goldbaum <ngold...@illinois.edu>
# Date 1502897089 18000
#  Wed Aug 16 10:24:49 2017 -0500
# Branch stable
# Node ID a1db17e964beee1a839769507818a50a5de3c9a3
# Parent  7686cbb0ba4138c56d038d8d82ccc052bf9b60d7
log: mention ui.logtemplate in the help text

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3335,7 +3335,9 @@ def log(ui, repo, *pats, **opts):
 revisions.
 
 See :hg:`help templates` for more about pre-packaged styles and
-specifying custom templates.
+specifying custom templates. The default template used by the log
+command can be customized via the ``ui.logtemplate`` configuration
+setting.
 
 Returns 0 on success.
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH stable] tag: clarify warning about making a tag on a branch head

2016-10-31 Thread Nathan Goldbaum
# HG changeset patch
# User Nathan Goldbaum <ngold...@illinois.edu>
# Date 1477951952 18000
#  Mon Oct 31 17:12:32 2016 -0500
# Branch stable
# Node ID ec11aa398c707b524b7e15994b5bf74bba6bc119
# Parent  69ffbbe73dd03df0d1a00bdb2bc083fdb73ede09
tag: clarify warning about making a tag on a branch head

Currently the warning is ambiguous about whether the new tag (possibly specified
via --rev) is being added on a branch head or whether the working directory is
based on a branch head. Clarify the error message to eliminate this ambiguity.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -7077,7 +7077,8 @@ def tag(ui, repo, name1, *names, **opts)
 raise error.Abort(_('uncommitted merge'))
 bheads = repo.branchheads()
 if not opts.get('force') and bheads and p1 not in bheads:
-raise error.Abort(_('not at a branch head (use -f to force)'))
+raise error.Abort(_('working directory is not at a branch head 
'
+'(use -f to force)'))
 r = scmutil.revsingle(repo, rev_).node()
 
 if not message:
diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -109,7 +109,7 @@ tagging on a non-head revision
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg tag -l localblah
   $ hg tag "foobar"
-  abort: not at a branch head (use -f to force)
+  abort: working directory is not at a branch head (use -f to force)
   [255]
   $ hg tag -f "foobar"
   $ cat .hgtags
@@ -339,7 +339,7 @@ tagging on null rev
   $ hg up null
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg tag nullrev
-  abort: not at a branch head (use -f to force)
+  abort: working directory is not at a branch head (use -f to force)
   [255]
 
   $ hg init empty
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH v5] crecord: add an event that scrolls the selected line to the top of the screen

2016-09-20 Thread Nathan Goldbaum
# HG changeset patch
# User Nathan Goldbaum <ngold...@illinois.edu>
# Date 1474383830 18000
#  Tue Sep 20 10:03:50 2016 -0500
# Node ID da914962b6c3f55c3f14cd7b82a4c0204c2d6a0d
# Parent  769aee32fae0f7eb8768ea2e90780af4e9a92761
crecord: add an event that scrolls the selected line to the top of the screen

Using ctrl-l for this purpose seems to be a fairly widely used practice,
presumably following emacs. This doesn't scroll the selected line all
the way to the top of the window, instead it leaves a 3 line buffer for
context. Use curses.unctrl() to resolve keypressed to '^L' to avoid
hard-coding hexadecimal key codes.

diff -r 769aee32fae0 -r da914962b6c3 mercurial/crecord.py
--- a/mercurial/crecord.py  Mon Sep 19 09:14:35 2016 -0700
+++ b/mercurial/crecord.py  Tue Sep 20 10:03:50 2016 -0500
@@ -715,6 +715,7 @@ class curseschunkselector(object):
 
 self.currentselecteditem = currentitem
 
+
 def updatescroll(self):
 "scroll the screen to fully show the currently-selected"
 selstart = self.selecteditemstartline
@@ -1338,6 +1339,7 @@ the following are valid keystrokes:
  shift-left-arrow   [H] : go to parent header / fold selected header
   f : fold / unfold item, hiding/revealing its children
   F : fold / unfold parent item and all of its ancestors
+ ctrl-l : scroll the selected line to the top of the screen
   m : edit / resume editing the commit message
   e : edit the currently selected hunk
   a : toggle amend mode, only with commit -i
@@ -1582,6 +1584,9 @@ are you sure you want to review/edit and
 self.helpwindow()
 self.stdscr.clear()
 self.stdscr.refresh()
+elif curses.unctrl(keypressed) in ["^L"]:
+# scroll the current line to the top of the screen
+self.scrolllines(self.selecteditemstartline)
 
 def main(self, stdscr):
 """
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2 v3] crecord: add an event that scrolls the selected line to the top of the screen

2016-09-20 Thread Nathan Goldbaum
On Tuesday, September 20, 2016, Pierre-Yves David <
pierre-yves.da...@ens-lyon.org> wrote:

>
>
> On 09/20/2016 12:23 AM, Nathan Goldbaum wrote:
>
>> # HG changeset patch
>> # User Nathan Goldbaum <ngold...@illinois.edu>
>> # Date 1474321033 18000
>> #  Mon Sep 19 16:37:13 2016 -0500
>> # Node ID 94afc22065e475ab1a61f68012be44f6dbbd0d64
>> # Parent  285a8c3e53f2183438f0cdbc238e4ab851d0d110
>> crecord: add an event that scrolls the selected line to the top of the
>> screen
>>
>> Using ctrl-l for this purpose seems to be a fairly widely used practice,
>> presumably following emacs. This doesn't scroll the selected line all
>> the way to the top of the window, instead it leaves a 3 line buffer for
>> context. Use curses.unctrl() to resolve keypressed to '^L' to avoid
>> hard-coding hexadecimal key codes.
>>
>> diff -r 285a8c3e53f2 -r 94afc22065e4 mercurial/crecord.py
>> --- a/mercurial/crecord.py  Tue May 03 13:36:12 2016 +0900
>> +++ b/mercurial/crecord.py  Mon Sep 19 16:37:13 2016 -0500
>> @@ -715,6 +715,10 @@ class curseschunkselector(object):
>>
>>  self.currentselecteditem = currentitem
>>
>> +def topscroll(self):
>> +"scroll so the currently selected line is at the top of the
>> screen"
>> +self.scrolllines(self.selecteditemstartline)
>> +
>>  def updatescroll(self):
>>  "scroll the screen to fully show the currently-selected"
>>  selstart = self.selecteditemstartline
>> @@ -1338,6 +1342,7 @@ the following are valid keystrokes:
>>   shift-left-arrow   [H] : go to parent header / fold selected header
>>f : fold / unfold item, hiding/revealing its
>> children
>>F : fold / unfold parent item and all of its
>> ancestors
>> + ctrl-l : scroll the selected line to the top of the
>> screen
>>m : edit / resume editing the commit message
>>e : edit the currently selected hunk
>>a : toggle amend mode, only with commit -i
>> @@ -1582,6 +1587,8 @@ are you sure you want to review/edit and
>>  self.helpwindow()
>>  self.stdscr.clear()
>>  self.stdscr.refresh()
>> +elif curses.unctrl(keypressed) in ["^L"]:
>> +self.topscroll()
>>
>
> any reason why we use 'in' instead of "==" here?


Following the other branches of the if/elif block in this function.


>
> Also, I'm not sure if the 'topscroll' method is that useful as it a
> one-liner. Should just call that code in the if clause?


Sure, I can send a v5


>
> Cheers,
>
> --
> Pierre-Yves David
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2 v3] crecord: delete commented line

2016-09-19 Thread Nathan Goldbaum
Ah, oops, thank you!

I will send a v4 with just the one new commit.

On Mon, Sep 19, 2016 at 5:04 PM, Sean Farley <s...@farley.io> wrote:

> Nathan Goldbaum <nathan12...@gmail.com> writes:
>
> > # HG changeset patch
> > # User Nathan Goldbaum <ngold...@illinois.edu>
> > # Date 1473871187 18000
> > #  Wed Sep 14 11:39:47 2016 -0500
> > # Node ID dec5dfcbd772a9f51674067ad18dff6d9bad78cf
> > # Parent  2c302c6544511b37abe61ee2cc5278e4f61d5e71
> > crecord: delete commented line
> >
> > diff -r 2c302c654451 -r dec5dfcbd772 mercurial/crecord.py
> > --- a/mercurial/crecord.pyWed Sep 14 17:12:39 2016 +0200
> > +++ b/mercurial/crecord.pyWed Sep 14 11:39:47 2016 -0500
> > @@ -719,7 +719,7 @@ class curseschunkselector(object):
> >  "scroll the screen to fully show the currently-selected"
> >  selstart = self.selecteditemstartline
> >  selend = self.selecteditemendline
> > -#selnumlines = selend - selstart
> > +
>
> I think this has already been queued:
>
> https://www.mercurial-scm.org/repo/hg-committed/rev/3664537386ab
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 v3] crecord: delete commented line

2016-09-19 Thread Nathan Goldbaum
# HG changeset patch
# User Nathan Goldbaum <ngold...@illinois.edu>
# Date 1473871187 18000
#  Wed Sep 14 11:39:47 2016 -0500
# Node ID dec5dfcbd772a9f51674067ad18dff6d9bad78cf
# Parent  2c302c6544511b37abe61ee2cc5278e4f61d5e71
crecord: delete commented line

diff -r 2c302c654451 -r dec5dfcbd772 mercurial/crecord.py
--- a/mercurial/crecord.py  Wed Sep 14 17:12:39 2016 +0200
+++ b/mercurial/crecord.py  Wed Sep 14 11:39:47 2016 -0500
@@ -719,7 +719,7 @@ class curseschunkselector(object):
 "scroll the screen to fully show the currently-selected"
 selstart = self.selecteditemstartline
 selend = self.selecteditemendline
-#selnumlines = selend - selstart
+
 padstart = self.firstlineofpadtoprint
 padend = padstart + self.yscreensize - self.numstatuslines - 1
 # 'buffered' pad start/end values which scroll with a certain
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 v2] crecord: delete commented line

2016-09-15 Thread Nathan Goldbaum
# HG changeset patch
# User Nathan Goldbaum <ngold...@illinois.edu>
# Date 1473871187 18000
#  Wed Sep 14 11:39:47 2016 -0500
# Node ID dec5dfcbd772a9f51674067ad18dff6d9bad78cf
# Parent  2c302c6544511b37abe61ee2cc5278e4f61d5e71
crecord: delete commented line

diff -r 2c302c654451 -r dec5dfcbd772 mercurial/crecord.py
--- a/mercurial/crecord.py  Wed Sep 14 17:12:39 2016 +0200
+++ b/mercurial/crecord.py  Wed Sep 14 11:39:47 2016 -0500
@@ -719,7 +719,7 @@ class curseschunkselector(object):
 "scroll the screen to fully show the currently-selected"
 selstart = self.selecteditemstartline
 selend = self.selecteditemendline
-#selnumlines = selend - selstart
+
 padstart = self.firstlineofpadtoprint
 padend = padstart + self.yscreensize - self.numstatuslines - 1
 # 'buffered' pad start/end values which scroll with a certain
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2 v2] crecord: add an event that scrolls the selected line to the top of the screen

2016-09-15 Thread Nathan Goldbaum
# HG changeset patch
# User Nathan Goldbaum <ngold...@illinois.edu>
# Date 1473965349 18000
#  Thu Sep 15 13:49:09 2016 -0500
# Node ID 3d1c9a829692bfb65ee269b236e2d695d9fed2b3
# Parent  dec5dfcbd772a9f51674067ad18dff6d9bad78cf
crecord: add an event that scrolls the selected line to the top of the screen

Using ctrl-l for this purpose seems to be a fairly widely used practice,
presumably following emacs. This doesn't scroll the selected line all
the way to the top of the window, instead it leaves a 3 line buffer for
context.

diff -r dec5dfcbd772 -r 3d1c9a829692 mercurial/crecord.py
--- a/mercurial/crecord.py  Wed Sep 14 11:39:47 2016 -0500
+++ b/mercurial/crecord.py  Thu Sep 15 13:49:09 2016 -0500
@@ -715,6 +715,10 @@ class curseschunkselector(object):
 
 self.currentselecteditem = currentitem
 
+def topscroll(self):
+"scroll so the currently selected line is at the top of the screen"
+self.scrolllines(self.selecteditemstartline)
+
 def updatescroll(self):
 "scroll the screen to fully show the currently-selected"
 selstart = self.selecteditemstartline
@@ -1338,6 +1342,7 @@ the following are valid keystrokes:
  shift-left-arrow   [H] : go to parent header / fold selected header
   f : fold / unfold item, hiding/revealing its children
   F : fold / unfold parent item and all of its ancestors
+ ctrl-l : scroll the selected line to the top of the screen
   m : edit / resume editing the commit message
   e : edit the currently selected hunk
   a : toggle amend mode, only with commit -i
@@ -1582,6 +1587,8 @@ are you sure you want to review/edit and
 self.helpwindow()
 self.stdscr.clear()
 self.stdscr.refresh()
+elif curses.keyname(ord(keypressed)) in ["^L"]:
+self.topscroll()
 
 def main(self, stdscr):
 """
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2] crecord: add an event that scrolls the selected line to the top of the screen

2016-09-14 Thread Nathan Goldbaum
# HG changeset patch
# User Nathan Goldbaum <ngold...@illinois.edu>
# Date 1473871467 18000
#  Wed Sep 14 11:44:27 2016 -0500
# Node ID 9698a2565e5bed4a07d8fbbfc9d1c77e840ad787
# Parent  dec5dfcbd772a9f51674067ad18dff6d9bad78cf
crecord: add an event that scrolls the selected line to the top of the screen

diff -r dec5dfcbd772 -r 9698a2565e5b mercurial/crecord.py
--- a/mercurial/crecord.py  Wed Sep 14 11:39:47 2016 -0500
+++ b/mercurial/crecord.py  Wed Sep 14 11:44:27 2016 -0500
@@ -715,6 +715,10 @@ class curseschunkselector(object):
 
 self.currentselecteditem = currentitem
 
+def topscroll(self):
+"scroll so the currently selected line is at the top of the screen"
+self.scrolllines(self.selecteditemstartline)
+
 def updatescroll(self):
 "scroll the screen to fully show the currently-selected"
 selstart = self.selecteditemstartline
@@ -977,7 +981,7 @@ class curseschunkselector(object):
 self.statuswin.refresh()
 return
 line1 = ("SELECT CHUNKS: (j/k/up/dn/pgup/pgdn) move cursor; "
-   "(space/A) toggle hunk/all; (e)dit hunk;")
+   "(space/A) toggle hunk/all; (e)dit hunk; (s)croll")
 line2 = (" (f)old/unfold; (c)onfirm applied; (q)uit; (?) help "
"| [X]=hunk applied **=folded, toggle [a]mend mode")
 
@@ -1338,6 +1342,7 @@ the following are valid keystrokes:
  shift-left-arrow   [H] : go to parent header / fold selected header
   f : fold / unfold item, hiding/revealing its children
   F : fold / unfold parent item and all of its ancestors
+  s : scroll the selected line to the top of the screen
   m : edit / resume editing the commit message
   e : edit the currently selected hunk
   a : toggle amend mode, only with commit -i
@@ -1553,6 +1558,8 @@ are you sure you want to review/edit and
 self.leftarrowevent()
 elif keypressed in ["H", "KEY_SLEFT"]:
 self.leftarrowshiftevent()
+elif keypressed in ["s"]:
+self.topscroll()
 elif keypressed in ["q"]:
 raise error.Abort(_('user quit'))
 elif keypressed in ['a']:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel