diff silvermirror/hg.py @ 1:9b139702a8f9

use a real backend architecture with an inteface and vastly simplify unify.py
author k0s <k0scist@gmail.com>
date Sat, 26 Sep 2009 23:36:42 -0400
parents
children 0d9094bb98b0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/silvermirror/hg.py	Sat Sep 26 23:36:42 2009 -0400
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+stub for the hg backend of silvermirror
+"""
+
+import os
+from mercurial import commands, hg, ui
+
+def update(host, path):
+    """
+    get changes from host on path
+    """
+    ui = ui.ui()
+    try: 
+        repo = hg.repository(ui, path)
+        command = commands.pull
+    except mercurial.repo.RepoError:
+        repo = hg.repository(ui, 'ssh://%s/%s' % (host, path))
+        command = commands.clone