Patchwork [Bug,6666] New: hg import rejects exported changeset in which a directory is emptied and replaced by a symlink

login
register
mail settings
Submitter mercurial-bugs@mercurial-scm.org
Date March 11, 2022, 12:15 p.m.
Message ID <bug-6666-285@https.bz.mercurial-scm.org/>
Download mbox | patch
Permalink /patch/50714/
State New
Headers show

Comments

mercurial-bugs@mercurial-scm.org - March 11, 2022, 12:15 p.m.
https://bz.mercurial-scm.org/show_bug.cgi?id=6666

            Bug ID: 6666
           Summary: hg import rejects exported changeset in which a
                    directory is emptied and replaced by a symlink
           Product: Mercurial
           Version: 6.1
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla@mercurial-scm.org
          Reporter: pushbx@ulukai.org
                CC: mercurial-devel@mercurial-scm.org
    Python Version: ---

I came across this bug while trying to fix a repo made from an svn mirror using
hg convert. I assume that the original error was made by convert. However, when
I tried to save the corrected changeset using hg export, I found that I could
not import it again using hg import. The following simple test case depicts the
error that the hg import gets in this case.

test$ hg --version
Mercurial Distributed SCM (version 6.1)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2022 Olivia Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
test$ hg init .
test$ mkdir dirtest
test$ mkdir target
test$ touch target/foo
test$ touch dirtest/bar
test$ hg add target/foo dirtest/bar
test$ hg ci -m "initial commit"
test$ hg rm dirtest/bar
test$ hg rm dirtest
test$ ln -s target dirtest
test$ hg add dirtest
test$ hg d
diff --git a/dirtest/bar b/dirtest/bar
deleted file mode 100644
test$ hg ci -m "turn directory into symlink"
test$ hg export > export
test$ hg strip -r tip
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
saved backup bundle to
[home]/test/20220311/test/.hg/strip-backup/0061a6917873-cd9c34cf-backup.hg
test$ hg import export
applying export
abort: Is a directory: '[home]/test/20220311/test/dirtest'
test$

Patch

diff --git a/dirtest b/dirtest
new file mode 120000
--- /dev/null
+++ b/dirtest
@@ -0,0 +1,1 @@ 
+target
\ No newline at end of file