[Bug 6820] New: Strange unshelve behavior with topic extension

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Wed Jun 14 20:01:44 UTC 2023


https://bz.mercurial-scm.org/show_bug.cgi?id=6820

            Bug ID: 6820
           Summary: Strange unshelve behavior with topic extension
           Product: Mercurial
           Version: 6.4.2
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: shelve
          Assignee: bugzilla at mercurial-scm.org
          Reporter: faheem at faheem.info
                CC: mercurial-devel at mercurial-scm.org
    Python Version: ---

The following recipe could be made simpler, but suffices to demonstrate the
issue. When unshelving, `unshelve` is trying to apply a patch to a file that
doesn't exist (`bar.txt`). It would normally stop and ask for instructions, but
here it creates a new `bar.txt` with an A (added) flag.

This is one of the options under normal behavior, but should not be the
default.

I'm posting my current recipe here. I might post a simplified version later.

rm -rf test-shelve2
hg init test-shelve2
cd test-shelve2
echo "First line of foo.txt" >> foo.txt
hg add foo.txt
hg ci -m "Add foo.txt"
echo "Second line of foo.txt" >> foo.txt
hg ci -m "foo.txt second line"
hg topic bar
echo "First line of bar.txt" >> bar.txt
hg add bar.txt
hg ci -m "Add bar.txt"
echo "Second line of bar.txt" >> bar.txt
hg ci -m "bar.txt second line"
find . -type f -name '*.txt' -exec sed -i 's/Second line/Second Line/g' {} +
hg shelve
hg shelve -p
hg up default
hg unshelve
hg status

This gives

faheem at orwell:~/test-mercurial$ sh shelve2.sh 
marked working directory as topic: bar
active topic 'bar' grew its first changeset
(see 'hg help topics' for more information)
shelved as default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
default         (1s ago)    changes to: bar.txt second line

diff --git a/bar.txt b/bar.txt
--- a/bar.txt
+++ b/bar.txt
@@ -1,2 +1,2 @@
 First line of bar.txt
-Second line of bar.txt
+Second Line of bar.txt
diff --git a/foo.txt b/foo.txt
--- a/foo.txt
+++ b/foo.txt
@@ -1,2 +1,2 @@
 First line of foo.txt
-Second line of foo.txt
+Second Line of foo.txt
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
unshelving change 'default'
rebasing shelved changes
M foo.txt
A bar.txt

Obviously, the `A bar.txt` part is very wrong.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list