Search code examples
version-controldarcs

Darcs record empty patch


I'm writing a repository conversion tool. The problem is the git-to-darcs part. Git can have empty commits; Darcs can't. For empty Mercurial commits, I just created a tag. I know Darcs has tags, but I can't figure out how to remove the tagged prefix from the messages.


Solution

  • You can trick Darcs into making an empty patch by creating a non-empty patch and then using amend-record to add an inverse change to it:

    ganesh@scafell ~/temp/1
    $ touch foo
    
    ganesh@scafell ~/temp/1
    $ darcs add foo
    Adding 'foo'
    
    ganesh@scafell ~/temp/1
    $ darcs rec
    addfile ./foo
    Shall I record this change? (1/1)  [ynW...], or ? for more options: y
    Do you want to record these changes? [Yglqk...], or ? for more options: y
    What is the patch name? foo
    Finished recording patch 'foo'
    
    ganesh@scafell ~/temp/1
    $ rm foo
    
    ganesh@scafell ~/temp/1
    $ darcs amend
    Wed May 28 06:49:22 GMT Daylight Time 2014  Ganesh Sittampalam <ganesh@earth.li>
      * foo
    Shall I amend this patch? [yNjk...], or ? for more options: y
    rmfile ./foo
    Shall I record this change? (1/1)  [ynW...], or ? for more options: y
    Do you want to record these changes? [Yglqk...], or ? for more options: y
    Finished amending patch:
    Wed May 28 06:49:31 GMT Daylight Time 2014  Ganesh Sittampalam <ganesh@earth.li>
      * foo