title: committing a single file using python-hglib
body: <p>I am trying to implement a rudimentary scm using python-hglib.<br>
  So far I have managed to connect to a repo (local) and I want to commit a single file among many.
  I am not sure how to do this. Consider the following:</p>
  
  <pre><code>client = hglib.open(my_mercurial_repo)
  root_repo=hglib.client.hgclient.root(client)
  print "%s root" % root_repo
  rev, node =client.commit('Simple commit message', addremove=False, user='user1')
  </code></pre>
  
  <p>This connects to <em>my_mercurial_repo</em> successfully, but when I get to the commit line I get this error:</p>
  
  <blockquote>
    <p>'hglib.error.CommandError'>, CommandError('commit', '-m',
    'Checkpoint', '-u', 'myself', '--debug')</p>
  </blockquote>
  
  <p>However if I change it to:</p>
  
  <blockquote>
    <p>rev, node =client.commit('Simple commit message', addremove=True,
    user='user1')</p>
  </blockquote>
  
  <p>It works fine. Looking at the documentation, <code>addremove=True</code> would mark new/missing files as added/removed before committing.</p>
  
  <p>So I guess my question is: how do I commit a single file in a repository of n files using python-hglib?</p>
  
  <p>Just a quick update, thanks to @kAlmAcetA's response I updated my code as suggested to include</p>
  
  <pre><code>client.add('/tmp/repo/somefile')
  rev, node =client.commit('Simple commit message', addremove=False, user='user1')
  </code></pre>
  
  <p>when I did this, the error goes away, the FIRST time commit is executed. 
  If I execute the code again on the same file that I had opened I still get the error. 
  So maybe what I am looking to do is to </p>
  
  <ul>
  <li>Open a file <em>(i'm ok with this)</em></li>
  <li>Add some text to the file <em>(i'm ok with this)</em></li>
  <li>Commit the file</li>
  <li>Add more text to the same file <em>(i'm ok with this)</em></li>
  <li>Commit the file</li>
  </ul>
  
  <p>I am now struggling to do the commit-->edit-->commit loop for a single file.</p>
  
  <p>Regards</p>