Mercurial: How do I revert a subrepo file?
-
26-06-2021 - |
Question
I have a mercurial repo with a sub-repo (in this case, bootstrap).
I modified the file, then modified it back manually, but hg still thinks it's modified and won't let me commit my other changes (I don't want to commit anything to the sup-repo).
dl@Debian6:~/company/company-production$ hg status -S
M company/cms/static/less/index.less ## I want this file
M company/cms/static/vendor/bootstrap/less/carousel.less ## I DONT want this file
M company/templates/v2/homepage/carousel.html ## I want this file
Above you can see the status thinks it's modified. But below when I run a diff carousel.less doesn't come up. Which is wierd to me.
dl@Debian6:~/company/company-production$ hg diff -S --stat
company/cms/static/less/index.less | 13 +++++++++++--
company/templates/v2/homepage/carousel.html | 10 ++++------
2 files changed, 15 insertions(+), 8 deletions(-)
So I try to revert the suprepo file. But it doesn't let me.
dl@Debian6:~/company/company-production$ hg revert company/cms/static/vendor/bootstrap/less/carousel.less
company/cms/static/vendor/bootstrap/less/carousel.less: no such file in rev 57e22a1738af
How do I revert the subrepo file: carousel.less, so I can commit my changes?
Solution
Change to the bootstrap
directory so you are in the subrepo, then run:
hg revert less/carousel.less
(it is odd that hg diff -S --stat
doesn't show the change, though.)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow