# HG changeset patch # User Pierre-Yves David <pierre-yves.david@octobus.net> # Date 1741260207 -3600 # Thu Mar 06 12:23:27 2025 +0100 # Branch stable # Node ID 7a4772e92f236e41f84fcee6efaf566784da1507 # Parent c3e450bfdf34f12b769729ffa12251d8e7374cea procutil: fix passing of stdin_bytes to background command When the command where run in the background, the std was closed. So we have to so do some file description juggling to make sure it is passed down. This was affecting automatic clone bundle generation and associated test was added. diff --git a/hgext/clonebundles.py b/hgext/clonebundles.py --- a/hgext/clonebundles.py +++ b/hgext/clonebundles.py @@ -1029,8 +1029,10 @@ details about how to configure this feature. """ debug = repo.ui.configbool(b'devel', b'debug.clonebundles') + op_id = repo.ui.config(b'devel', b'clonebundles.override-operation-id') bundles = read_auto_gen(repo) - op_id = b"%d_acbr" % os.getpid() + if op_id is None: + op_id = b"%d_acbr" % os.getpid() create, delete = auto_bundle_needed_actions(repo, bundles, op_id) # if some bundles are scheduled for creation in the background, they will diff --git a/mercurial/configitems.toml b/mercurial/configitems.toml --- a/mercurial/configitems.toml +++ b/mercurial/configitems.toml @@ -465,6 +465,15 @@ [[items]] section = "devel" +name = "clonebundles.override-operation-id" +documentation = """ +override the operation id used to produce unique filename at generation time. + +Useful to stabilize some filename in the tests. +""" + +[[items]] +section = "devel" name = "check-locks" default = false diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -743,7 +743,7 @@ script = b' '.join(shellquote(x) for x in cmd) if record_wait is None: # double-fork to completely detach from the parent process - script = b'( %s ) &' % script + script = b'( ( %s ) <&3 3<&- &) 3<&0' % script start_new_session = True else: start_new_session = False diff --git a/tests/test-clonebundles-autogen.t b/tests/test-clonebundles-autogen.t --- a/tests/test-clonebundles-autogen.t +++ b/tests/test-clonebundles-autogen.t @@ -411,12 +411,61 @@ full-bzip2-v2-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) $ ls -1 ../server/.hg/tmp-bundles +background generation without debug +----------------------------------- + +The debug option make the command wait for background process and change the +way stdin is accessible to the script. So we also test this variant. + +Gather the name of the expected bundle + + $ v1_file=$TESTTMP/final-upload/full-bzip2-v1-11_revs-4226b1cd5fda_tip-background_testing.hg + $ v2_file=$TESTTMP/final-upload/full-bzip2-v2-11_revs-4226b1cd5fda_tip-background_testing.hg + +cleanup things + + + $ hg -R ../server/ admin::clone-bundles-clear + clone-bundles: deleting bundle full-bzip2-v1-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) + clone-bundles: deleting bundle full-bzip2-v2-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) +(also delete the manifest to be sure) + $ rm ../server/.hg/clonebundles.manifest + +Nothing should remain + + $ cat ../server/.hg/clonebundles.auto-gen + $ ls -1 ../final-upload + $ ls -1 ../server/.hg/tmp-bundles + +Start a process in the background without the debug option + + $ hg -R ../server/ admin::clone-bundles-refresh --background \ + > --config devel.debug.clonebundles=no \ + > --config devel.clonebundles.override-operation-id=background_testing + + $ $RUNTESTDIR/testlib/wait-on-file 30 $v1_file + $ $RUNTESTDIR/testlib/wait-on-file 30 $v2_file + +We should have bundle now + + $ cat ../server/.hg/clonebundles.manifest + file:/*/$TESTTMP/final-upload/full-bzip2-v1-11_revs-4226b1cd5fda_tip-background_testing.hg BUNDLESPEC=bzip2-v1 (glob) + file:/*/$TESTTMP/final-upload/full-bzip2-v2-11_revs-4226b1cd5fda_tip-background_testing.hg BUNDLESPEC=bzip2-v2 (glob) + $ ls -1 ../final-upload + full-bzip2-v1-11_revs-4226b1cd5fda_tip-background_testing.hg + full-bzip2-v2-11_revs-4226b1cd5fda_tip-background_testing.hg + $ ls -1 ../server/.hg/tmp-bundles + + + + + Test HTTP URL ========================= $ hg -R ../server/ admin::clone-bundles-clear - clone-bundles: deleting bundle full-bzip2-v1-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) - clone-bundles: deleting bundle full-bzip2-v2-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) + clone-bundles: deleting bundle full-bzip2-v1-11_revs-4226b1cd5fda_tip-*.hg (glob) + clone-bundles: deleting bundle full-bzip2-v2-11_revs-4226b1cd5fda_tip-*.hg (glob) $ cat >> ../server/.hg/hgrc << EOF > [clone-bundles] # HG changeset patch # User Anton Shestakov <av6@dwimlabs.net> # Date 1740750852 -14400 # Fri Feb 28 17:54:12 2025 +0400 # Branch stable # Node ID 771706c5acfb43675a0cc21651d2343ab4bbba12 # Parent 7a4772e92f236e41f84fcee6efaf566784da1507 tests: pygments 2.19+ highlight more whitespace in python code Let's repeat 42baf12efd21. diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -666,7 +666,9 @@ return 0, 0 -@checkvers("pygments", "Pygments version >= %s", ('2.5', '2.11', '2.14')) +@checkvers( + "pygments", "Pygments version >= %s", ('2.5', '2.11', '2.14', '2.19') +) def has_pygments_range(v): major, minor = v.split('.')[0:2] return getpygmentsversion() >= (int(major), int(minor)) diff --git a/tests/test-highlight.t b/tests/test-highlight.t --- a/tests/test-highlight.t +++ b/tests/test-highlight.t @@ -160,12 +160,15 @@ <span id="l4"><span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></span><a href="#l4"></a> <span id="l5"><span class="sd">"""</span></span><a href="#l5"></a> <span id="l6"></span><a href="#l6"></a> - <span id="l7"><span class="kn">import</span> <span class="nn">itertools</span></span><a href="#l7"></a> + <span id="l7"><span class="kn">import</span><span class="w"> </span><span class="nn">itertools</span></span><a href="#l7"></a> (pygments219 !) + <span id="l7"><span class="kn">import</span> <span class="nn">itertools</span></span><a href="#l7"></a> (no-pygments219 !) <span id="l8"></span><a href="#l8"></a> - <span id="l9"><span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></span><a href="#l9"></a> + <span id="l9"><span class="kn">def</span><span class="w"> </span><span class="nf">primes</span><span class="p">():</span></span><a href="#l9"></a> (pygments219 !) + <span id="l9"><span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></span><a href="#l9"></a> (no-pygments219 !) <span id="l10"><span class="w"> </span><span class="sd">"""Generate all primes."""</span></span><a href="#l10"></a> (pygments214 !) <span id="l10"> <span class="sd">"""Generate all primes."""</span></span><a href="#l10"></a> (no-pygments214 !) - <span id="l11"> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l11"></a> + <span id="l11"> <span class="kn">def</span><span class="w"> </span><span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l11"></a> (pygments219 !) + <span id="l11"> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l11"></a> (no-pygments219 !) <span id="l12"> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></span><a href="#l12"></a> <span id="l13"> <span class="c"># It is important to yield *here* in order to stop the</span></span><a href="#l13"></a> <span id="l14"> <span class="c"># infinite recursion.</span></span><a href="#l14"></a> @@ -179,7 +182,8 @@ <span id="l22"> <span class="kn">return</span> <span class="n">itertools</span><span class="o">.</span><span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></span><a href="#l22"></a> <span id="l23"></span><a href="#l23"></a> <span id="l24"><span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></span><a href="#l24"></a> - <span id="l25"> <span class="kn">import</span> <span class="nn">sys</span></span><a href="#l25"></a> + <span id="l25"> <span class="kn">import</span><span class="w"> </span><span class="nn">sys</span></span><a href="#l25"></a> (pygments219 !) + <span id="l25"> <span class="kn">import</span> <span class="nn">sys</span></span><a href="#l25"></a> (no-pygments219 !) <span id="l26"> <span class="kn">try</span><span class="p">:</span></span><a href="#l26"></a> <span id="l27"> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></span><a href="#l27"></a> <span id="l28"> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></span><a href="#l28"></a> @@ -439,7 +443,8 @@ <a href="/rev/687f2d169546">changeset</a> </div> </td> - <td class="source followlines-btn-parent"><a href="#l7"> 7</a> <span class="kn">import</span> <span class="nn">itertools</span></td> + <td class="source followlines-btn-parent"><a href="#l7"> 7</a> <span class="kn">import</span><span class="w"> </span><span class="nn">itertools</span></td> (pygments219 !) + <td class="source followlines-btn-parent"><a href="#l7"> 7</a> <span class="kn">import</span> <span class="nn">itertools</span></td> (no-pygments219 !) </tr> <tr id="l8" class="thisrev"> <td class="annotate parity0"> @@ -473,7 +478,8 @@ <a href="/rev/687f2d169546">changeset</a> </div> </td> - <td class="source followlines-btn-parent"><a href="#l9"> 9</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td> + <td class="source followlines-btn-parent"><a href="#l9"> 9</a> <span class="kn">def</span><span class="w"> </span><span class="nf">primes</span><span class="p">():</span></td> (pygments219 !) + <td class="source followlines-btn-parent"><a href="#l9"> 9</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td> (no-pygments219 !) </tr> <tr id="l10" class="thisrev"> <td class="annotate parity0"> @@ -508,7 +514,8 @@ <a href="/rev/687f2d169546">changeset</a> </div> </td> - <td class="source followlines-btn-parent"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> + <td class="source followlines-btn-parent"><a href="#l11"> 11</a> <span class="kn">def</span><span class="w"> </span><span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> (pygments219 !) + <td class="source followlines-btn-parent"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> (no-pygments219 !) </tr> <tr id="l12" class="thisrev"> <td class="annotate parity0"> @@ -746,7 +753,8 @@ <a href="/rev/687f2d169546">changeset</a> </div> </td> - <td class="source followlines-btn-parent"><a href="#l25"> 25</a> <span class="kn">import</span> <span class="nn">sys</span></td> + <td class="source followlines-btn-parent"><a href="#l25"> 25</a> <span class="kn">import</span><span class="w"> </span><span class="nn">sys</span></td> (pygments219 !) + <td class="source followlines-btn-parent"><a href="#l25"> 25</a> <span class="kn">import</span> <span class="nn">sys</span></td> (no-pygments219 !) </tr> <tr id="l26" class="thisrev"> <td class="annotate parity0"> @@ -1022,7 +1030,8 @@ $ cat hg.pid >> $DAEMON_PIDS $ get-with-headers.py localhost:$HGPORT 'file/tip/unknownfile' | grep l2 - <span id="l2"><span class="k">def</span> <span class="nf">foo</span><span class="p">():</span></span><a href="#l2"></a> + <span id="l2"><span class="k">def</span><span class="w"> </span><span class="nf">foo</span><span class="p">():</span></span><a href="#l2"></a> (pygments219 !) + <span id="l2"><span class="k">def</span> <span class="nf">foo</span><span class="p">():</span></span><a href="#l2"></a> (no-pygments219 !) We can prevent Pygments from falling back to a non filename-based detection mode # HG changeset patch # User Pierre-Yves David <pierre-yves.david@octobus.net> # Date 1741613313 -3600 # Mon Mar 10 14:28:33 2025 +0100 # Branch stable # Node ID 6e1eb7212633b3af6feda2c06e8bc26253010aec # Parent 771706c5acfb43675a0cc21651d2343ab4bbba12 nightly-build: attempt to no longer choke on existing file When we run the job multiple time, the upload step fails because the file always exists. So we pass the `--skip-existing` flag that is supposed to help with that… when supported. This might have no effect outside of upload to PyPI as the doc says: Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.) diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml +++ b/contrib/heptapod-ci.yml @@ -702,5 +702,6 @@ upload --verbose --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi + --skip-existing wheels/*/*/*/*.whl wheels/*/*.whl # HG changeset patch # User Pierre-Yves David <pierre-yves.david@octobus.net> # Date 1741662939 -3600 # Tue Mar 11 04:15:39 2025 +0100 # Node ID a232522d377076537ae60536fe868b1623e9515d # Parent d81714a1c88d5143d3999afaa6e4eab4f32f590e # Parent 6e1eb7212633b3af6feda2c06e8bc26253010aec branching: merge with stable diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml +++ b/contrib/heptapod-ci.yml @@ -702,5 +702,6 @@ upload --verbose --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi + --skip-existing wheels/*/*/*/*.whl wheels/*/*.whl diff --git a/hgext/clonebundles.py b/hgext/clonebundles.py --- a/hgext/clonebundles.py +++ b/hgext/clonebundles.py @@ -1029,8 +1029,10 @@ details about how to configure this feature. """ debug = repo.ui.configbool(b'devel', b'debug.clonebundles') + op_id = repo.ui.config(b'devel', b'clonebundles.override-operation-id') bundles = read_auto_gen(repo) - op_id = b"%d_acbr" % os.getpid() + if op_id is None: + op_id = b"%d_acbr" % os.getpid() create, delete = auto_bundle_needed_actions(repo, bundles, op_id) # if some bundles are scheduled for creation in the background, they will diff --git a/mercurial/configitems.toml b/mercurial/configitems.toml --- a/mercurial/configitems.toml +++ b/mercurial/configitems.toml @@ -465,6 +465,15 @@ [[items]] section = "devel" +name = "clonebundles.override-operation-id" +documentation = """ +override the operation id used to produce unique filename at generation time. + +Useful to stabilize some filename in the tests. +""" + +[[items]] +section = "devel" name = "check-locks" default = false diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -743,7 +743,7 @@ script = b' '.join(shellquote(x) for x in cmd) if record_wait is None: # double-fork to completely detach from the parent process - script = b'( %s ) &' % script + script = b'( ( %s ) <&3 3<&- &) 3<&0' % script start_new_session = True else: start_new_session = False diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -666,7 +666,9 @@ return 0, 0 -@checkvers("pygments", "Pygments version >= %s", ('2.5', '2.11', '2.14')) +@checkvers( + "pygments", "Pygments version >= %s", ('2.5', '2.11', '2.14', '2.19') +) def has_pygments_range(v): major, minor = v.split('.')[0:2] return getpygmentsversion() >= (int(major), int(minor)) diff --git a/tests/test-clonebundles-autogen.t b/tests/test-clonebundles-autogen.t --- a/tests/test-clonebundles-autogen.t +++ b/tests/test-clonebundles-autogen.t @@ -411,12 +411,61 @@ full-bzip2-v2-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) $ ls -1 ../server/.hg/tmp-bundles +background generation without debug +----------------------------------- + +The debug option make the command wait for background process and change the +way stdin is accessible to the script. So we also test this variant. + +Gather the name of the expected bundle + + $ v1_file=$TESTTMP/final-upload/full-bzip2-v1-11_revs-4226b1cd5fda_tip-background_testing.hg + $ v2_file=$TESTTMP/final-upload/full-bzip2-v2-11_revs-4226b1cd5fda_tip-background_testing.hg + +cleanup things + + + $ hg -R ../server/ admin::clone-bundles-clear + clone-bundles: deleting bundle full-bzip2-v1-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) + clone-bundles: deleting bundle full-bzip2-v2-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) +(also delete the manifest to be sure) + $ rm ../server/.hg/clonebundles.manifest + +Nothing should remain + + $ cat ../server/.hg/clonebundles.auto-gen + $ ls -1 ../final-upload + $ ls -1 ../server/.hg/tmp-bundles + +Start a process in the background without the debug option + + $ hg -R ../server/ admin::clone-bundles-refresh --background \ + > --config devel.debug.clonebundles=no \ + > --config devel.clonebundles.override-operation-id=background_testing + + $ $RUNTESTDIR/testlib/wait-on-file 30 $v1_file + $ $RUNTESTDIR/testlib/wait-on-file 30 $v2_file + +We should have bundle now + + $ cat ../server/.hg/clonebundles.manifest + file:/*/$TESTTMP/final-upload/full-bzip2-v1-11_revs-4226b1cd5fda_tip-background_testing.hg BUNDLESPEC=bzip2-v1 (glob) + file:/*/$TESTTMP/final-upload/full-bzip2-v2-11_revs-4226b1cd5fda_tip-background_testing.hg BUNDLESPEC=bzip2-v2 (glob) + $ ls -1 ../final-upload + full-bzip2-v1-11_revs-4226b1cd5fda_tip-background_testing.hg + full-bzip2-v2-11_revs-4226b1cd5fda_tip-background_testing.hg + $ ls -1 ../server/.hg/tmp-bundles + + + + + Test HTTP URL ========================= $ hg -R ../server/ admin::clone-bundles-clear - clone-bundles: deleting bundle full-bzip2-v1-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) - clone-bundles: deleting bundle full-bzip2-v2-11_revs-4226b1cd5fda_tip-*_acbr.hg (glob) + clone-bundles: deleting bundle full-bzip2-v1-11_revs-4226b1cd5fda_tip-*.hg (glob) + clone-bundles: deleting bundle full-bzip2-v2-11_revs-4226b1cd5fda_tip-*.hg (glob) $ cat >> ../server/.hg/hgrc << EOF > [clone-bundles] diff --git a/tests/test-highlight.t b/tests/test-highlight.t --- a/tests/test-highlight.t +++ b/tests/test-highlight.t @@ -160,12 +160,15 @@ <span id="l4"><span class="sd"> where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]</span></span><a href="#l4"></a> <span id="l5"><span class="sd">"""</span></span><a href="#l5"></a> <span id="l6"></span><a href="#l6"></a> - <span id="l7"><span class="kn">import</span> <span class="nn">itertools</span></span><a href="#l7"></a> + <span id="l7"><span class="kn">import</span><span class="w"> </span><span class="nn">itertools</span></span><a href="#l7"></a> (pygments219 !) + <span id="l7"><span class="kn">import</span> <span class="nn">itertools</span></span><a href="#l7"></a> (no-pygments219 !) <span id="l8"></span><a href="#l8"></a> - <span id="l9"><span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></span><a href="#l9"></a> + <span id="l9"><span class="kn">def</span><span class="w"> </span><span class="nf">primes</span><span class="p">():</span></span><a href="#l9"></a> (pygments219 !) + <span id="l9"><span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></span><a href="#l9"></a> (no-pygments219 !) <span id="l10"><span class="w"> </span><span class="sd">"""Generate all primes."""</span></span><a href="#l10"></a> (pygments214 !) <span id="l10"> <span class="sd">"""Generate all primes."""</span></span><a href="#l10"></a> (no-pygments214 !) - <span id="l11"> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l11"></a> + <span id="l11"> <span class="kn">def</span><span class="w"> </span><span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l11"></a> (pygments219 !) + <span id="l11"> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></span><a href="#l11"></a> (no-pygments219 !) <span id="l12"> <span class="n">p</span> <span class="o">=</span> <span class="n">ns</span><span class="o">.</span><span class="n">next</span><span class="p">()</span></span><a href="#l12"></a> <span id="l13"> <span class="c"># It is important to yield *here* in order to stop the</span></span><a href="#l13"></a> <span id="l14"> <span class="c"># infinite recursion.</span></span><a href="#l14"></a> @@ -179,7 +182,8 @@ <span id="l22"> <span class="kn">return</span> <span class="n">itertools</span><span class="o">.</span><span class="n">chain</span><span class="p">([</span><span class="mi">2</span><span class="p">],</span> <span class="n">sieve</span><span class="p">(</span><span class="n">dropwhile</span><span class="p">(</span><span class="kn">lambda</span> <span class="n">n</span><span class="p">:</span> <span class="n">n</span> <span class="o"><</span> <span class="mi">3</span><span class="p">,</span> <span class="n">odds</span><span class="p">)))</span></span><a href="#l22"></a> <span id="l23"></span><a href="#l23"></a> <span id="l24"><span class="kn">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span></span><a href="#l24"></a> - <span id="l25"> <span class="kn">import</span> <span class="nn">sys</span></span><a href="#l25"></a> + <span id="l25"> <span class="kn">import</span><span class="w"> </span><span class="nn">sys</span></span><a href="#l25"></a> (pygments219 !) + <span id="l25"> <span class="kn">import</span> <span class="nn">sys</span></span><a href="#l25"></a> (no-pygments219 !) <span id="l26"> <span class="kn">try</span><span class="p">:</span></span><a href="#l26"></a> <span id="l27"> <span class="n">n</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span></span><a href="#l27"></a> <span id="l28"> <span class="kn">except</span> <span class="p">(</span><span class="ne">ValueError</span><span class="p">,</span> <span class="ne">IndexError</span><span class="p">):</span></span><a href="#l28"></a> @@ -439,7 +443,8 @@ <a href="/rev/687f2d169546">changeset</a> </div> </td> - <td class="source followlines-btn-parent"><a href="#l7"> 7</a> <span class="kn">import</span> <span class="nn">itertools</span></td> + <td class="source followlines-btn-parent"><a href="#l7"> 7</a> <span class="kn">import</span><span class="w"> </span><span class="nn">itertools</span></td> (pygments219 !) + <td class="source followlines-btn-parent"><a href="#l7"> 7</a> <span class="kn">import</span> <span class="nn">itertools</span></td> (no-pygments219 !) </tr> <tr id="l8" class="thisrev"> <td class="annotate parity0"> @@ -473,7 +478,8 @@ <a href="/rev/687f2d169546">changeset</a> </div> </td> - <td class="source followlines-btn-parent"><a href="#l9"> 9</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td> + <td class="source followlines-btn-parent"><a href="#l9"> 9</a> <span class="kn">def</span><span class="w"> </span><span class="nf">primes</span><span class="p">():</span></td> (pygments219 !) + <td class="source followlines-btn-parent"><a href="#l9"> 9</a> <span class="kn">def</span> <span class="nf">primes</span><span class="p">():</span></td> (no-pygments219 !) </tr> <tr id="l10" class="thisrev"> <td class="annotate parity0"> @@ -508,7 +514,8 @@ <a href="/rev/687f2d169546">changeset</a> </div> </td> - <td class="source followlines-btn-parent"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> + <td class="source followlines-btn-parent"><a href="#l11"> 11</a> <span class="kn">def</span><span class="w"> </span><span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> (pygments219 !) + <td class="source followlines-btn-parent"><a href="#l11"> 11</a> <span class="kn">def</span> <span class="nf">sieve</span><span class="p">(</span><span class="n">ns</span><span class="p">):</span></td> (no-pygments219 !) </tr> <tr id="l12" class="thisrev"> <td class="annotate parity0"> @@ -746,7 +753,8 @@ <a href="/rev/687f2d169546">changeset</a> </div> </td> - <td class="source followlines-btn-parent"><a href="#l25"> 25</a> <span class="kn">import</span> <span class="nn">sys</span></td> + <td class="source followlines-btn-parent"><a href="#l25"> 25</a> <span class="kn">import</span><span class="w"> </span><span class="nn">sys</span></td> (pygments219 !) + <td class="source followlines-btn-parent"><a href="#l25"> 25</a> <span class="kn">import</span> <span class="nn">sys</span></td> (no-pygments219 !) </tr> <tr id="l26" class="thisrev"> <td class="annotate parity0"> @@ -1022,7 +1030,8 @@ $ cat hg.pid >> $DAEMON_PIDS $ get-with-headers.py localhost:$HGPORT 'file/tip/unknownfile' | grep l2 - <span id="l2"><span class="k">def</span> <span class="nf">foo</span><span class="p">():</span></span><a href="#l2"></a> + <span id="l2"><span class="k">def</span><span class="w"> </span><span class="nf">foo</span><span class="p">():</span></span><a href="#l2"></a> (pygments219 !) + <span id="l2"><span class="k">def</span> <span class="nf">foo</span><span class="p">():</span></span><a href="#l2"></a> (no-pygments219 !) We can prevent Pygments from falling back to a non filename-based detection mode