How is the node revision ID getting updated? I have a question related to _node_save_revision function in drupal 7. I just want to know how I can get the new revision ID after saving a revision using this function

It is mentioned in the documentation here.


  The resulting revision ID is available afterward in $node-&gt;vid.


But how does this happen? Where is the new revision ID assigned to the node object?
drupal_write_record handles that.

vid is the primary key on the node_revision table, as declared in node_schema, and drupal_write_record knows that because it introspects the schema when writing the record.

From there it just takes the ID returned from the database query, and populates the correct property on the object that was passed in. In this case, that's the vid property on the node object.