Mercurial > hg-git
changeset 774:9c6bd4102ef5
git_handler: move remote ref writing to a separate function
For consistency with save_map and save_tags.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 03 Sep 2014 19:55:28 +0200 |
parents | 55887ce9fb98 |
children | 81e5e8e0185c |
files | hggit/git_handler.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py Wed Sep 03 19:47:37 2014 +0200 +++ b/hggit/git_handler.py Wed Sep 03 19:55:28 2014 +0200 @@ -206,6 +206,12 @@ td = [line.split(' ', 1) for line in tagdata if line] self._remote_refs.update([(name, bin(sha)) for sha, name in td]) + def save_remote_refs(self): + tf = open(self.repo.join(self.remote_refs_file), 'wb') + for tag, node in self.remote_refs.iteritems(): + tf.write('%s %s\n' % (hex(node), tag)) + tf.close() + ## END FILE LOAD AND SAVE METHODS ## COMMANDS METHODS @@ -1257,7 +1263,6 @@ ' bookmarks enabled?\n')) def update_remote_branches(self, remote_name, refs): - tagfile = self.repo.join(self.remote_refs_file) remote_refs = self.remote_refs # since we re-write all refs for this remote each time, prune # all entries matching this remote from our refs list now so @@ -1280,11 +1285,7 @@ and not ref_name.endswith('^{}')): self.git.refs[ref_name] = sha - tf = open(tagfile, 'wb') - for tag, node in tags.iteritems(): - tf.write('%s %s\n' % (hex(node), tag)) - tf.close() - + self.save_remote_refs() ## UTILITY FUNCTIONS