patch (heavily untested) to show idea - maxdifflines in [web] in hgrc

Warren Postma warren.postma at gmail.com
Thu Apr 8 09:40:39 CDT 2010


Well, I've never suggested a patch to an open source product before.  I
suppose I'll do this wrong. But here goes.

This is a sample of a possible feature, a patch against
mercurial.selenic.com/hg/hg/. Needs testing.
Obviously not ready for production.  You've been warned. Yadda yadda. Your
source code will be entirely lost, and your kittens will be accidentally
drowned.

Modified: hgweb/webcommands.py and hgweb/webutil.py:

Purpose of this patch:
Added New hgrc entry:
   [web]
   maxdifflines = nnn

When maxdifflines > 0 specified in hgrc, the changeset summary will use
ellipsis for diff hunks that are greater than nnn lines in length. For
example, maxdifflines = 10 means we only get 10 lines or less per changed
file in that fileset. This makes skimming a large changeset easier, and you
can still use hgweb to view
a particular file's entire changeset. This change appears in the inner
function
webutils.diffs.prettyprintlines, for which two inner implementations are
provided, the classic fast generator, and one with a length limit that
raises
StopIteration.  Performance for people who do not use this hgrc option
should
not be affected unless the refactor (def getltype).

changes:
 webutil.diffs takes optional parameter maxdifflines.
 webcommands.changeset reads web.config("web","maxdifflines","-1")


*It occurs to me that maybe it would be better if the [web] entry was
changesetmaxdifflines, since it's only giant changesets that I find hard to
skim on hgweb.

*Anyways, the truncated output looks like this, if your hgrc [web] section
has maxdifflines = 10:

Note that the diff is not completely ended, but rather the block is
truncated. This allows skimming (fast reads) through a diff that hits a lot
of files.
My patch does not provide for any templating or i18n for the message "...
omitted the rest of block 48 ...". I am not arrogant enough to suppose that
my little patch will be useful to everybody, or even most hg users, but as
it seems very useful to me, I'm posting it here, only to receive comments.
Feel free to use, or not use my little idea, and I will not feel hurt if you
do, or you don't.    I release all copyright and ownership on this patch,
and if any or all of it is used, the owner of this project may assume
copyright and all other rights associated with this patch.

    48.1 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.1>
--- a/Tekran/Stack/DataServer_2_Stable/Config/SystemIdentificationFm.dfm	Wed
Mar 17 18:01:20 2010 +0000
    48.2 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.2>
+++ b/Tekran/Stack/DataServer_2_Stable/Config/SystemIdentificationFm.dfm	Mon
Mar 22 14:31:41 2010 +0000
    48.3 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.3>
@@ -468,10 +468,6 @@
    48.4 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.4>
     TabOrder = 1
    48.5 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.5>
     object TabSheetSysId: TTabSheet
    48.6 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.6>
       Caption = 'System and Site Identification'
    48.7 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.7>
-      ExplicitLeft = 0
    48.8 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.8>
-      ExplicitTop = 0
    48.9 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.9>
-      ExplicitWidth = 0
   48.10 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.10>
-      ExplicitHeight = 0
   48.11 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l48.11>
... omitted the rest of block 48 ...

    49.1 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.1>
--- a/Tekran/Stack/DataServer_2_Stable/Connectivity/ModbusServer/TekModbusServerMain.dfm	Wed
Mar 17 18:01:20 2010 +0000
    49.2 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.2>
+++ b/Tekran/Stack/DataServer_2_Stable/Connectivity/ModbusServer/TekModbusServerMain.dfm	Mon
Mar 22 14:31:41 2010 +0000
    49.3 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.3>
@@ -497,10 +497,6 @@
    49.4 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.4>
     object TabSheetTrace: TTabSheet
    49.5 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.5>
       Caption = 'Trace'
    49.6 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.6>
       ImageIndex = 1
    49.7 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.7>
-      ExplicitLeft = 0
    49.8 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.8>
-      ExplicitTop = 0
    49.9 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.9>
-      ExplicitWidth = 0
   49.10 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.10>
-      ExplicitHeight = 0
   49.11 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l49.11>
... omitted the rest of block 49 ...

    50.1 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.1>
--- a/Tekran/Stack/DataServer_2_Stable/Modbus/ModbusWorksheetFm.dfm	Wed
Mar 17 18:01:20 2010 +0000
    50.2 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.2>
+++ b/Tekran/Stack/DataServer_2_Stable/Modbus/ModbusWorksheetFm.dfm	Mon
Mar 22 14:31:41 2010 +0000
    50.3 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.3>
@@ -95,10 +95,6 @@
    50.4 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.4>
     TabOrder = 1
    50.5 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.5>
     object TabSheetModbusPoints: TTabSheet
    50.6 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.6>
       Caption = 'Modbus Points'
    50.7 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.7>
-      ExplicitLeft = 0
    50.8 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.8>
-      ExplicitTop = 0
    50.9 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.9>
-      ExplicitWidth = 0
   50.10 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.10>
-      ExplicitHeight = 0
   50.11 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l50.11>
... omitted the rest of block 50 ...

    51.1 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.1>
--- a/Tekran/Stack/DataServer_2_Stable/TagDb/TagDatabaseEditorFm.dfm	Wed
Mar 17 18:01:20 2010 +0000
    51.2 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.2>
+++ b/Tekran/Stack/DataServer_2_Stable/TagDb/TagDatabaseEditorFm.dfm	Mon
Mar 22 14:31:41 2010 +0000
    51.3 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.3>
@@ -161,10 +161,6 @@
    51.4 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.4>
     object TabSheetGroup: TTabSheet
    51.5 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.5>
       Caption = 'Group'
    51.6 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.6>
       ImageIndex = 11
    51.7 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.7>
-      ExplicitLeft = 0
    51.8 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.8>
-      ExplicitTop = 0
    51.9 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.9>
-      ExplicitWidth = 0
   51.10 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.10>
-      ExplicitHeight = 0
   51.11 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l51.11>
... omitted the rest of block 51 ...

    52.1 <http://devserver1/hg/imported_from_svn/rev/b56f398b845a#l52.1>
Binary file Tekran/Stack/Icons/dataserver2_5_researchversion_2010.ico
has changed



Thoughts? Comments?

Thanks folks.

Warren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial/attachments/20100408/645ba62b/attachment.htm>


More information about the Mercurial mailing list