Bug 5732 - amend doesn't respect removed/missing state, but uses filesystem state
Summary: amend doesn't respect removed/missing state, but uses filesystem state
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 4.4
Hardware: PC Linux
: urgent bug
Assignee: Yuya Nishihara
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2017-11-04 10:37 UTC by Yuya Nishihara
Modified: 2017-12-06 00:00 UTC (History)
2 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuya Nishihara 2017-11-04 10:37 UTC
Spotted when fixing the bug 5677.

STR:

  $ hg init $TESTTMP/repo4
  $ cd $TESTTMP/repo4

 create a file to be removed

  $ echo a > a
  $ hg add a
  $ hg ci -m0

 create a file to be missing

  $ echo b > b
  $ hg add b
  $ hg ci -m1

 missing file should not be removed

  $ rm b
  $ hg amend
  nothing changed
  [1]

 removed file should be removed even if the file exists in working directory

  $ hg forget a
BROKEN: missing file is removed, and removed file is not removed
  $ hg amend
  saved backup bundle to * (glob)
  $ hg status --change .
Comment 1 Bugzilla 2017-11-19 00:00 UTC
Bug was set to IN_PROGRESS for 14 days, moving back to confirmed
Comment 2 HG Bot 2017-11-28 20:20 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/0ba3b928f9a9
Yuya Nishihara <yuya@tcha.org>
amend: do not take untracked files as modified or clean (issue5732)

fctx.exists() shouldn't be used here as it checks if a file physically exists,
which may disagree with the dirstate.

(please test the fix)
Comment 3 HG Bot 2017-11-28 20:20 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/5f40efa472db
Yuya Nishihara <yuya@tcha.org>
amend: do not drop missing files (issue5732)

samefile() can be wrong since wctx.manifest() does not include missing files,
whereas missing files should be preserved on commit.

(please test the fix)
Comment 4 Bugzilla 2017-12-06 00:00 UTC
Bug was set to TESTING for 7 days, resolving