andialbrecht / hgsvn (http://cheeseshop.python.org/pypi/hgsvn)
A set of scripts to work locally on Subversion checkouts using Mercurial.
Clone this repository (size: 254.6 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/andialbrecht/hgsvn/
| commit 211: | 79ede2c76304 |
| parent 210: | c4bd091d3504 |
| branch: | hgsvn |
make import check for working changes
Changed (Δ333 bytes):
raw changeset »
hgsvn/run/hgimportsvn.py (7 lines added, 2 lines removed)
hgsvn/svnclient.py (6 lines added, 2 lines removed)
Up to file-list hgsvn/run/hgimportsvn.py:
| … | … | @@ -75,8 +75,7 @@ def main(): |
75 |
75 |
if options.local_only: |
76 |
76 |
target_svn_url = os.path.abspath(target_svn_url) |
77 |
77 |
local_repo = target_svn_url |
78 |
# else: |
|
79 |
# target_svn_url = actual_svn_url |
|
78 |
||
80 |
79 |
# e.g. u'/branches/xmpp-subprotocols-2178-2' |
81 |
80 |
svn_path = actual_svn_url[len(repos_url):] |
82 |
81 |
# e.g. 'xmpp-subprotocols-2178-2' |
| … | … | @@ -99,6 +98,12 @@ def main(): |
99 |
98 |
nlocal_repo = os.path.abspath(local_repo) |
100 |
99 |
print "%s must be a SVN checkout for --local-only" % nlocal_repo |
101 |
100 |
sys.exit(1) |
101 |
elif options.local_only and is_svn_dir: |
|
102 |
status = get_svn_status(local_repo, quiet=True) |
|
103 |
if status: |
|
104 |
print ("There are uncommitted changes. Either commit them or put " |
|
105 |
"them aside before running hgimportsvn.") |
|
106 |
sys.exit(1) |
|
102 |
107 |
else: |
103 |
108 |
os.mkdir(local_repo) |
104 |
109 |
fixup_hgsvn_dir(local_repo) |
Up to file-list hgsvn/svnclient.py:
| … | … | @@ -23,7 +23,7 @@ except ImportError: |
23 |
23 |
svn_log_args = ['log', '--xml', '-v'] |
24 |
24 |
svn_info_args = ['info', '--xml'] |
25 |
25 |
svn_checkout_args = ['checkout', '-q'] |
26 |
svn_status_args = ['status', '--xml', '- |
|
26 |
svn_status_args = ['status', '--xml', '--ignore-externals'] |
|
27 |
27 |
|
28 |
28 |
_identity_table = "".join(map(chr, range(256))) |
29 |
29 |
_forbidden_xml_chars = "".join( |
| … | … | @@ -174,13 +174,17 @@ def run_svn_log(svn_url_or_wc, rev_start |
174 |
174 |
xml_string = run_svn(svn_log_args + args) |
175 |
175 |
return parse_svn_log_xml(xml_string) |
176 |
176 |
|
177 |
def get_svn_status(svn_wc |
|
177 |
def get_svn_status(svn_wc, quiet=False): |
|
178 |
178 |
""" |
179 |
179 |
Get SVN status information about the given working copy. |
180 |
180 |
""" |
181 |
181 |
# Ensure proper stripping by canonicalizing the path |
182 |
182 |
svn_wc = os.path.abspath(svn_wc) |
183 |
183 |
args = [svn_wc] |
184 |
if quiet: |
|
185 |
args += ['-q'] |
|
186 |
else: |
|
187 |
args += ['-v'] |
|
184 |
188 |
xml_string = run_svn(svn_status_args + args) |
185 |
189 |
return parse_svn_status_xml(xml_string, svn_wc) |
186 |
190 |
