D6486: copies: separate added/removed files by newline instead of null

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jun 6 17:11:12 UTC 2019


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

REVISION SUMMARY
  This makes it more consistent with how we encode copies
  (newline-separated lists of null-separated pairs). This perhaps makes
  {extras} a little less readable (?) despite avoiding the escaping. I
  don't know how I feel about this patch. I'm okay with it being queued
  or dropped.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changelog.py
  tests/test-copies-in-changeset.t
  tests/test-copies.t

CHANGE DETAILS

diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -620,7 +620,7 @@
 
   $ hg rebase -r . -d 2 -t :other
   rebasing 5:5018b1509e94 "added willconflict and d" (tip) (no-changeset !)
-  rebasing 5:619047c26bf8 "added willconflict and d" (tip) (changeset !)
+  rebasing 5:af8d273bf580 "added willconflict and d" (tip) (changeset !)
 
   $ hg up 3 -q
   $ hg l --hidden
@@ -644,4 +644,4 @@
 
   $ hg graft -r 6 --base 4 --hidden -t :other
   grafting 6:99802e4f1e46 "added willconflict and d" (tip) (no-changeset !)
-  grafting 6:9ddc6fb3b691 "added willconflict and d" (tip) (changeset !)
+  grafting 6:b19f0df72728 "added willconflict and d" (tip) (changeset !)
diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -25,7 +25,9 @@
   $ hg ci -m 'copy a to b, c, and d'
   $ hg changesetcopies
   files: b c d
-  filesadded: 0\x001\x002 (esc)
+  filesadded: 0
+  1
+  2
   
   p1copies: 0\x00a (esc)
   1\x00a (esc)
@@ -95,7 +97,9 @@
   $ hg ci -m 'merge'
   $ hg changesetcopies
   files: g h i
-  filesadded: 0\x001\x002 (esc)
+  filesadded: 0
+  1
+  2
   
   p1copies: 0\x00a (esc)
   2\x00f (esc)
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -109,12 +109,12 @@
     for i, f in enumerate(files):
         if f in subset:
             indices.append('%d' % i)
-    return '\0'.join(indices)
+    return '\n'.join(indices)
 
 def decodefileindices(files, data):
     try:
         subset = []
-        for strindex in data.split('\0'):
+        for strindex in data.split('\n'):
             i = int(strindex)
             if i < 0 or i >= len(files):
                 return None



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


More information about the Mercurial-devel mailing list