I have an /etc file tree which is managed by etckeeper, based on Mercurial. After running apt-get dist-upgrade, I want to revision the changes which have been applied by the upgrade.

However, when doing

hg add $(hg status . --unknown --no-status)

I get this conflict:

abort: file 'php5/apache2/conf.d' in dirstate clashes with 'php5/apache2/conf.d/05-opcache.ini'

hg status php5/apache2/conf.d

gives me:

! php5/apache2/conf.d
? php5/apache2/conf.d/05-opcache.ini
? php5/apache2/conf.d/10-pdo.ini
? php5/apache2/conf.d/20-json.ini
? php5/apache2/conf.d/20-readline.ini

This looks contradictory to me: If the directory php5/apache2/conf.d would be missing, how could it contain new (unversioned) files?!

How can I resolve this conflict?

(Debian Linux, upgraded 7.11 to 8.5; Mercurial 3.4.2)


It seems the missing (/etc/)php5/apache2/conf.d was a symlink which was replaced by a directory.

I put the directory in a tar archive, just to be safe, and tried hg revert php5/apache2/conf.d, which yielded (German version; sorry, I forgot to repeat with LANG=C):

Abbruch: Konnte symbolische Verknüpfung auf '../conf.d' nicht erzeugen: File exists: '/etc/php5/apach2e/conf.d'

If hg revert tries to create a symbolic link, I assume the missing resource was a symlink. This little dance did the trick (twice - for php5/apache2 and php5/cli):

mv conf.d conf.d-tmp
hg rm conf.d
hg commit conf.d -m 'Conflict resolution, part 1'
mv conf.d-tmp conf.d
hg commit conf.d -m 'Conflict resolution, part 2'

After doing this I was able to add all remaining "unknown" resources, and to remove all remaining "deleted" resources:

hg add $(hg status -un)
hg rm $(hg status -dn)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.