D1636: tests: use Python to write binary data in lfs test instead of shell

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Sun Dec 10 01:50:36 UTC 2017


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The shell construct here appears to be unevenly supported: it works in /bin/sh
  on FreeBSD, but it doesn't seem to work when /bin/sh is dash. Using a Python
  inline directive works fine, so let's just do that instead.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-lfs.t

CHANGE DETAILS

diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -232,9 +232,10 @@
   $ hg mv b1 a2
   $ hg commit -m b
   $ hg status
-  $ HEADER=$'\1\n'
-  $ printf '%sSTART-WITH-HG-FILELOG-METADATA' "$HEADER" > a2
-  $ printf '%sMETA\n' "$HEADER" > a1
+  >>> with open('a2', 'wb') as f:
+  ...     f.write('\1\nSTART-WITH-HG-FILELOG-METADATA')
+  >>> with open('a1', 'wb') as f:
+  ...     f.write('\1\nMETA\n')
   $ hg commit -m meta
   $ hg status
   $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n'



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list