hgsubversion: allow inferring the svn layout from the commit

Reviewed By: mitrandir77

Differential Revision: D15206676

fbshipit-source-id: fc7604bfa2df9cd1d47e4a5d582f0efe80339531
This commit is contained in:
Saurabh Singh 2019-05-13 11:45:27 -07:00 committed by Facebook Github Bot
parent 3f3e91d339
commit 29e1278187
3 changed files with 22 additions and 12 deletions

View File

@ -370,6 +370,11 @@ configitem("hgsubversion", "revmapimpl", default=configitem.dynamicdefault)
# real default is 'auto'
configitem("hgsubversion", "layout", default=configitem.dynamicdefault)
# Skips the validation of Subversion layout inferred from a commit against the
# layout configured for the repository while updating the revmap for that
# commit. The layout inferred from the commit is used for the update.
configitem("hgsubversion", "usecommitlayout", default=False)
# real default is True
configitem("hgsubversion", "defaultauthors", default=configitem.dynamicdefault)
# real default is False

View File

@ -209,21 +209,25 @@ def _buildmeta(ui, repo, args, partial=False, skipuuid=False):
subdir = "/" + subdir
if subdir and subdir[-1] == "/":
subdir = subdir[:-1]
assert revpath.startswith(subdir), (
"That does not look like the " "right location in the repo."
)
# meta.layout is a config-cached property so instead of testing for
# None we test to see if the layout is 'auto' and, if so, try to
# guess the layout based on the commits (where subdir is compared to
# the revpath extracted from the commit)
if meta.layout == "auto":
if ui.configbool("hgsubversion", "usecommitlayout"):
meta.layout = meta.layout_from_commit(subdir, revpath, ctx.branch())
elif meta.layout == "single":
assert (subdir or "/") == revpath, (
"Possible layout detection" " defect in replay"
else:
assert revpath.startswith(subdir), (
"That does not look like the " "right location in the repo."
)
# meta.layout is a config-cached property so instead of testing for
# None we test to see if the layout is 'auto' and, if so, try to
# guess the layout based on the commits (where subdir is compared to
# the revpath extracted from the commit)
if meta.layout == "auto":
meta.layout = meta.layout_from_commit(subdir, revpath, ctx.branch())
elif meta.layout == "single":
assert (subdir or "/") == revpath, (
"Possible layout detection" " defect in replay"
)
# write repository uuid if required
if meta.uuid is None or validateuuid:
validateuuid = False
@ -520,7 +524,7 @@ def svn(ui, repo, subcommand, *args, **opts):
ui.status("Bad arguments for subcommand %s\n" % subcommand)
else:
raise
except KeyError as e:
except KeyError:
tb = traceback.extract_tb(sys.exc_info()[2])
if len(tb) == 1:
ui.status("Unknown subcommand %s\n" % subcommand)

View File

@ -95,6 +95,7 @@ New errors are not allowed. Warnings are strongly discouraged.
undocumented: hgsubversion.stupid (bool)
undocumented: hgsubversion.tunnels (list)
undocumented: hgsubversion.unsafeskip (list)
undocumented: hgsubversion.usecommitlayout (bool)
undocumented: hgsubversion.username (str)
undocumented: infinitepush.bgssh (str)
undocumented: infinitepush.bundle-stream (bool)