Mercurial > evolve
comparison hgext/evolve.py @ 1055:cfe1b9d3e5d9 stable
import: handle patch with no node information
patch created by old Mercurial version or other tool have no node information.
We cannot create marker in this case.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 14 Aug 2014 15:17:02 -0700 |
parents | 93e920feff5e |
children | 00bc31523074 f3867e60d072 |
comparison
equal
deleted
inserted
replaced
1054:93e920feff5e | 1055:cfe1b9d3e5d9 |
---|---|
931 | 931 |
932 @eh.wrapfunction(mercurial.cmdutil, 'tryimportone') | 932 @eh.wrapfunction(mercurial.cmdutil, 'tryimportone') |
933 def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs): | 933 def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs): |
934 extracted = patch.extract(ui, hunk) | 934 extracted = patch.extract(ui, hunk) |
935 expected = extracted[5] | 935 expected = extracted[5] |
936 expected = node.bin(expected) | 936 if extracted is not None: |
937 expected = node.bin(expected) | |
937 oldextract = patch.extract | 938 oldextract = patch.extract |
938 try: | 939 try: |
939 patch.extract = lambda ui, hunk: extracted | 940 patch.extract = lambda ui, hunk: extracted |
940 ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs) | 941 ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs) |
941 finally: | 942 finally: |
942 patch.extract = oldextract | 943 patch.extract = oldextract |
943 created = ret[1] | 944 created = ret[1] |
944 if opts['obsolete'] and created is not None and created != expected: | 945 if (opts['obsolete'] and None not in (created, expected) |
946 and created != expected): | |
945 tr = repo.transaction('import-obs') | 947 tr = repo.transaction('import-obs') |
946 try: | 948 try: |
947 metadata = {'user': ui.username()} | 949 metadata = {'user': ui.username()} |
948 repo.obsstore.create(tr, expected, (created,), | 950 repo.obsstore.create(tr, expected, (created,), |
949 metadata=metadata) | 951 metadata=metadata) |