Changeset 98a58c679345…
Parent 8daab782def8…
by Daniel Pupek
Changes to 4 files · Browse files at 98a58c679345 Showing diff from parent 8daab782def8 Diff from another changeset...
@@ -52,7 +52,7 @@
from cookielib import MozillaCookieJar
from hashlib import md5
-from mercurial import (commands, cmdutil, demandimport, extensions, hg,
+from mercurial import (commands, cmdutil, registrar, demandimport, extensions, hg,
localrepo, match, util)
from mercurial import ui as hgui
from mercurial import url as hgurl
@@ -895,7 +895,14 @@ return needles.intersection(haystacks)
cmdtable = {}
-command = cmdutil.command(cmdtable)
+
+if hasattr(cmdutil, 'command'):
+ # Mercurial 4.6 or less
+ command = cmdutil.command(cmdtable)
+else:
+ # Mercurial 4.7+
+ command = registrar.command(cmdtable)
+
@command('kiln',
[('a', 'annotate', [], _('annotate the file provided')),
('c', 'changes', None, _('view the history of this repository; this is the default')),
|
@@ -55,6 +55,7 @@ import mercurial.url
from mercurial import commands
from mercurial import cmdutil
+from mercurial import registrar
current_user = None
@@ -183,9 +184,9 @@ except:
current_user = ''
-def extsetup():
+def extsetup(ui):
global current_user
- ui = mercurial.ui.ui()
+
current_user = get_username(get_dest(ui))
def open_wrapper(func):
@@ -222,7 +223,14 @@ opt_no_repo = {'norepo': True}
cmdtable = {}
-command = cmdutil.command(cmdtable)
+
+if hasattr(cmdutil, 'command'):
+ # Mercurial 4.6 or less
+ command = cmdutil.command(cmdtable)
+else:
+ # Mercurial 4.7+
+ command = registrar.command(cmdtable)
+
@command('logout', [], _('[domain]'), **opt_no_repo)
def logout(ui, domain=None, **opts):
"""log out of http repositories
|
@@ -1,34 +1,34 @@ - import os
-import subprocess
-import sys
-import hgtest
-
-path = os.path.dirname(os.path.realpath(__file__))
-
-args = vars(hgtest.parse_args())
-arglist = []
-for opt, val in args.iteritems():
- arglist.extend(['--' + opt, val])
-
-files = os.listdir(path)
-failures = 0
-
-for file in files:
- if file.startswith("test") and file.endswith(".py"):
- try:
- child = subprocess.Popen(["python", os.path.join(path, file)] + arglist,
- stdout=sys.stdout,
- stderr=sys.stderr,
- stdin=sys.stdin,
- universal_newlines=True)
-
- ret = child.wait()
- if ret != 0:
- failures += 1
- except:
- if child.poll():
- child.kill()
- raise
-
-if failures > 0:
+import os
+import subprocess
+import sys
+import hgtest
+
+path = os.path.dirname(os.path.realpath(__file__))
+
+args = vars(hgtest.parse_args())
+arglist = []
+for opt, val in args.iteritems():
+ arglist.extend(['--' + opt, val])
+
+files = os.listdir(path)
+failures = 0
+
+for file in files:
+ if file.startswith("test") and file.endswith(".py"):
+ try:
+ child = subprocess.Popen(["python", os.path.join(path, file)] + arglist,
+ stdout=sys.stdout,
+ stderr=sys.stderr,
+ stdin=sys.stdin,
+ universal_newlines=True)
+
+ ret = child.wait()
+ if ret != 0:
+ failures += 1
+ except:
+ if child.poll():
+ child.kill()
+ raise
+
+if failures > 0:
sys.exit("%i files failed" % failures)
\ No newline at end of file |
@@ -1,38 +1,38 @@ - import hgtest
-import os
-
-hgt = hgtest.Tester(auth=False)
-hgt.announce('setup')
-token = hgt.gettoken()
-hgt.deletetest(token)
-test = hgt.createtest(token)
-hgt.hg(['clone', hgt.test_url(), 'repo1'], log=False, auth=True,
- stdout='''no changes found
-updating to branch default
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-''')
-os.chdir('repo1')
-
-hgt.hg(['logout'])
-
-hgt.hg(['pull'], stdin='\n\n', status=-1,
- stderr='abort: http authorization required for %s' % hgt.test_url(),
- stdout='''pulling from %s
-''' % hgt.test_url())
-
-hgt.hg(['pull'], auth=True,
- stdout='''pulling from %s
-no changes found
-''' % hgt.test_url())
-
-hgt.hg(['pull'],
- stdout='''pulling from %s
-no changes found
-''' % hgt.test_url())
-
-hgt.hg(['logout'])
-
-hgt.hg(['pull'], stdin='\n\n', status=-1,
- stderr='abort: http authorization required for %s' % hgt.test_url(),
- stdout='''pulling from %s
-''' % hgt.test_url())
+import hgtest
+import os
+
+hgt = hgtest.Tester(auth=False)
+hgt.announce('setup')
+token = hgt.gettoken()
+hgt.deletetest(token)
+test = hgt.createtest(token)
+hgt.hg(['clone', hgt.test_url(), 'repo1'], log=False, auth=True,
+ stdout='''no changes found
+updating to branch default
+0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+''')
+os.chdir('repo1')
+
+hgt.hg(['logout'])
+
+hgt.hg(['pull'], stdin='\n\n', status=-1,
+ stderr='abort: http authorization required for %s' % hgt.test_url(),
+ stdout='''pulling from %s
+''' % hgt.test_url())
+
+hgt.hg(['pull'], auth=True,
+ stdout='''pulling from %s
+no changes found
+''' % hgt.test_url())
+
+hgt.hg(['pull'],
+ stdout='''pulling from %s
+no changes found
+''' % hgt.test_url())
+
+hgt.hg(['logout'])
+
+hgt.hg(['pull'], stdin='\n\n', status=-1,
+ stderr='abort: http authorization required for %s' % hgt.test_url(),
+ stdout='''pulling from %s
+''' % hgt.test_url())
|
Loading...