Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15331896
D21392.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D21392.diff
View Options
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,4 @@
# Python extension compiled files.
/support/hg/arc-hg.pyc
+/support/hg/__pycache__/
diff --git a/support/hg/arc-hg.py b/support/hg/arc-hg.py
--- a/support/hg/arc-hg.py
+++ b/support/hg/arc-hg.py
@@ -1,4 +1,14 @@
from __future__ import absolute_import
+import sys
+
+is_python_3 = sys.version_info[0] >= 3
+
+if is_python_3:
+ def arc_items(dict):
+ return dict.items()
+else:
+ def arc_items(dict):
+ return dict.iteritems()
import os
import json
@@ -19,8 +29,8 @@
command = registrar.command(cmdtable)
@command(
- "arc-ls-markers",
- [('', 'output', '',
+ b'arc-ls-markers',
+ [(b'', b'output', b'',
_('file to output refs to'), _('FILE')),
] + cmdutil.remoteopts,
_('[--output FILENAME] [SOURCE]'))
@@ -42,6 +52,16 @@
else:
markers = remotemarkers(ui, repo, source, opts)
+ for m in markers:
+ if m['name'] != None:
+ m['name'] = m['name'].decode('utf-8')
+
+ if m['node'] != None:
+ m['node'] = m['node'].decode('utf-8')
+
+ if m['description'] != None:
+ m['description'] = m['description'].decode('utf-8')
+
json_opts = {
'indent': 2,
'sort_keys': True,
@@ -54,14 +74,15 @@
with open(output_file, 'w+') as f:
json.dump(markers, f, **json_opts)
else:
- print json.dumps(markers, output_file, **json_opts)
+ json_data = json.dumps(markers, **json_opts)
+ print(json_data)
return 0
def localmarkers(ui, repo):
markers = []
- active_node = repo['.'].node()
+ active_node = repo[b'.'].node()
all_heads = set(repo.heads())
current_name = repo.dirstate.branch()
saw_current = False
@@ -117,7 +138,7 @@
bookmarks = repo._bookmarks
active_bookmark = repo._activebookmark
- for bookmark_name, bookmark_node in bookmarks.iteritems():
+ for bookmark_name, bookmark_node in arc_items(bookmarks):
is_active = (active_bookmark == bookmark_name)
description = repo[bookmark_node].description()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 8, 2:59 PM (3 d, 13 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7381974
Default Alt Text
D21392.diff (1 KB)
Attached To
Mode
D21392: Allow "hg arc-ls-markers" to run under Python 2 or Python 3
Attached
Detach File
Event Timeline
Log In to Comment