Show More
@@ -800,13 +800,13 b' def selectfile(afile_orig, bfile_orig, h' | |||||
800 | while i < pathlen - 1 and path[i] == '/': |
|
800 | while i < pathlen - 1 and path[i] == '/': | |
801 | i += 1 |
|
801 | i += 1 | |
802 | count -= 1 |
|
802 | count -= 1 | |
803 | return path[i:].rstrip() |
|
803 | return path[:i].lstrip(), path[i:].rstrip() | |
804 |
|
804 | |||
805 | nulla = afile_orig == "/dev/null" |
|
805 | nulla = afile_orig == "/dev/null" | |
806 | nullb = bfile_orig == "/dev/null" |
|
806 | nullb = bfile_orig == "/dev/null" | |
807 | afile = pathstrip(afile_orig, strip) |
|
807 | abase, afile = pathstrip(afile_orig, strip) | |
808 | gooda = not nulla and os.path.exists(afile) |
|
808 | gooda = not nulla and os.path.exists(afile) | |
809 | bfile = pathstrip(bfile_orig, strip) |
|
809 | bbase, bfile = pathstrip(bfile_orig, strip) | |
810 | if afile == bfile: |
|
810 | if afile == bfile: | |
811 | goodb = gooda |
|
811 | goodb = gooda | |
812 | else: |
|
812 | else: | |
@@ -815,16 +815,20 b' def selectfile(afile_orig, bfile_orig, h' | |||||
815 | if reverse: |
|
815 | if reverse: | |
816 | createfunc = hunk.rmfile |
|
816 | createfunc = hunk.rmfile | |
817 | missing = not goodb and not gooda and not createfunc() |
|
817 | missing = not goodb and not gooda and not createfunc() | |
|
818 | # If afile is "a/b/foo" and bfile is "a/b/foo.orig" we assume the | |||
|
819 | # diff is between a file and its backup. In this case, the original | |||
|
820 | # file should be patched (see original mpatch code). | |||
|
821 | isbackup = (abase == bbase and bfile.startswith(afile)) | |||
818 | fname = None |
|
822 | fname = None | |
819 | if not missing: |
|
823 | if not missing: | |
820 | if gooda and goodb: |
|
824 | if gooda and goodb: | |
821 |
fname = |
|
825 | fname = isbackup and afile or bfile | |
822 | elif gooda: |
|
826 | elif gooda: | |
823 | fname = afile |
|
827 | fname = afile | |
824 |
|
828 | |||
825 | if not fname: |
|
829 | if not fname: | |
826 | if not nullb: |
|
830 | if not nullb: | |
827 |
fname = |
|
831 | fname = isbackup and afile or bfile | |
828 | elif not nulla: |
|
832 | elif not nulla: | |
829 | fname = afile |
|
833 | fname = afile | |
830 | else: |
|
834 | else: |
@@ -225,3 +225,22 b' hg import remove.diff' | |||||
225 | hg manifest |
|
225 | hg manifest | |
226 | cd .. |
|
226 | cd .. | |
227 |
|
227 | |||
|
228 | echo % 'test update+rename with common name (issue 927)' | |||
|
229 | hg init t | |||
|
230 | cd t | |||
|
231 | touch a | |||
|
232 | hg ci -Am t | |||
|
233 | echo a > a | |||
|
234 | # Here, bfile.startswith(afile) | |||
|
235 | hg copy a a2 | |||
|
236 | hg ci -m copya | |||
|
237 | hg export --git tip > copy.diff | |||
|
238 | hg up -C 0 | |||
|
239 | hg import copy.diff | |||
|
240 | echo % view a | |||
|
241 | # a should contain an 'a' | |||
|
242 | cat a | |||
|
243 | echo % view a2 | |||
|
244 | # and a2 should have duplicated it | |||
|
245 | cat a2 | |||
|
246 | cd .. |
@@ -232,3 +232,11 b' diff --git a/a b/a' | |||||
232 | diff --git a/b b/b |
|
232 | diff --git a/b b/b | |
233 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
233 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
234 | applying remove.diff |
|
234 | applying remove.diff | |
|
235 | % test update+rename with common name (issue 927) | |||
|
236 | adding a | |||
|
237 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
238 | applying copy.diff | |||
|
239 | % view a | |||
|
240 | a | |||
|
241 | % view a2 | |||
|
242 | a |
General Comments 0
You need to be logged in to leave comments.
Login now