Pierre-Yves David avatar Pierre-Yves David committed b836862

[convert] properly exclude null successors from convertion

Old remain of the old way to kill changeset.

Comments (0)

Files changed (2)

hgext/obsolete.py

                 del oldmark['id']  # dropped for now
                 del oldmark['reason']  # unused until then
                 oldobject = str(oldmark.pop('object'))
-                oldsubjects = [str(s) for s in oldmark.pop('subjects')]
+                oldsubjects = [str(s) for s in oldmark.pop('subjects', [])]
                 LOOKUP_ERRORS = (error.RepoLookupError, error.LookupError)
                 if len(oldobject) != 40:
                     try:
                 meta = dict((k.encode('utf-8'), v.encode('utf-8'))
                              for k, v in oldmark.iteritems())
                 try:
-                    store.create(bin(oldobject), [bin(n) for n in oldsubjects],
+                    succs = [bin(n) for n in oldsubjects]
+                    succs = [n for n in succs if n != nullid]
+                    store.create(bin(oldobject), succs,
                                  0, meta)
                     cnt += 1
                 except ValueError:

tests/test-oldconvert.t

   >     }, 
   >     {
   >         "reason": "import from older format.", 
-  >         "subjects": [
-  >             "a37154106de358121a32a3dd6ba0281931550515"
-  >         ], 
   >         "user": "Pierre-Yves David <pierre-yves.david@logilab.fr>", 
   >         "date": [
   >             1336557472.7875929, 
   >     {
   >         "reason": "import from older format.", 
   >         "subjects": [
-  >             "dc8d8aa6e8ac490fcafd074d570df0787ee0ee69"
+  >             "0000000000000000000000000000000000000000"
   >         ], 
   >         "user": "Pierre-Yves David <pierre-yves.david@logilab.fr>", 
   >         "date": [
   $ hg debugconvertobsolete --traceback
   3 obsolete marker converted
   $ hg debugsuccessors
-  2c3784e102bb dc8d8aa6e8ac
+  2c3784e102bb
   3e03d82708d4 3218406b50ed
-  5c722672795c a37154106de3
+  5c722672795c
   7c3bad9141dc d67cd0334eee
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.