Show More
@@ -87,9 +87,8 b' def setup():' | |||||
87 |
|
87 | |||
88 | def clonenarrowcmd(orig, ui, repo, *args, **opts): |
|
88 | def clonenarrowcmd(orig, ui, repo, *args, **opts): | |
89 | """Wraps clone command, so 'hg clone' first wraps localrepo.clone().""" |
|
89 | """Wraps clone command, so 'hg clone' first wraps localrepo.clone().""" | |
90 | opts = pycompat.byteskwargs(opts) |
|
|||
91 | wrappedextraprepare = util.nullcontextmanager() |
|
90 | wrappedextraprepare = util.nullcontextmanager() | |
92 |
narrowspecfile = opts[ |
|
91 | narrowspecfile = opts['narrowspec'] | |
93 |
|
92 | |||
94 | if narrowspecfile: |
|
93 | if narrowspecfile: | |
95 | filepath = os.path.join(encoding.getcwd(), narrowspecfile) |
|
94 | filepath = os.path.join(encoding.getcwd(), narrowspecfile) | |
@@ -115,24 +114,25 b' def clonenarrowcmd(orig, ui, repo, *args' | |||||
115 | narrowspec.validatepatterns(excludes) |
|
114 | narrowspec.validatepatterns(excludes) | |
116 |
|
115 | |||
117 | # narrowspec is passed so we should assume that user wants narrow clone |
|
116 | # narrowspec is passed so we should assume that user wants narrow clone | |
118 |
opts[ |
|
117 | opts['narrow'] = True | |
119 |
opts[ |
|
118 | opts['include'].extend(includes) | |
120 |
opts[ |
|
119 | opts['exclude'].extend(excludes) | |
121 |
|
120 | |||
122 |
if opts[ |
|
121 | if opts['narrow']: | |
123 |
|
122 | |||
124 | def pullbundle2extraprepare_widen(orig, pullop, kwargs): |
|
123 | def pullbundle2extraprepare_widen(orig, pullop, kwargs): | |
125 | orig(pullop, kwargs) |
|
124 | orig(pullop, kwargs) | |
126 |
|
125 | |||
127 |
if opts.get( |
|
126 | if opts.get('depth'): | |
128 | kwargs[b'depth'] = opts[b'depth'] |
|
127 | # TODO: fix exchange._pullbundle2extraprepare() | |
|
128 | kwargs[b'depth'] = opts['depth'] | |||
129 |
|
129 | |||
130 | wrappedextraprepare = extensions.wrappedfunction( |
|
130 | wrappedextraprepare = extensions.wrappedfunction( | |
131 | exchange, '_pullbundle2extraprepare', pullbundle2extraprepare_widen |
|
131 | exchange, '_pullbundle2extraprepare', pullbundle2extraprepare_widen | |
132 | ) |
|
132 | ) | |
133 |
|
133 | |||
134 | with wrappedextraprepare: |
|
134 | with wrappedextraprepare: | |
135 |
return orig(ui, repo, *args, ** |
|
135 | return orig(ui, repo, *args, **opts) | |
136 |
|
136 | |||
137 |
|
137 | |||
138 | def pullnarrowcmd(orig, ui, repo, *args, **opts): |
|
138 | def pullnarrowcmd(orig, ui, repo, *args, **opts): | |
@@ -511,7 +511,6 b' def trackedcmd(ui, repo, remotepath=None' | |||||
511 | add --addinclude, --addexclude rules in bulk. Like the other include and |
|
511 | add --addinclude, --addexclude rules in bulk. Like the other include and | |
512 | exclude switches, the changes are applied immediately. |
|
512 | exclude switches, the changes are applied immediately. | |
513 | """ |
|
513 | """ | |
514 | opts = pycompat.byteskwargs(opts) |
|
|||
515 | if requirements.NARROW_REQUIREMENT not in repo.requirements: |
|
514 | if requirements.NARROW_REQUIREMENT not in repo.requirements: | |
516 | raise error.InputError( |
|
515 | raise error.InputError( | |
517 | _( |
|
516 | _( | |
@@ -522,11 +521,11 b' def trackedcmd(ui, repo, remotepath=None' | |||||
522 |
|
521 | |||
523 | # Before supporting, decide whether it "hg tracked --clear" should mean |
|
522 | # Before supporting, decide whether it "hg tracked --clear" should mean | |
524 | # tracking no paths or all paths. |
|
523 | # tracking no paths or all paths. | |
525 |
if opts[ |
|
524 | if opts['clear']: | |
526 | raise error.InputError(_(b'the --clear option is not yet supported')) |
|
525 | raise error.InputError(_(b'the --clear option is not yet supported')) | |
527 |
|
526 | |||
528 | # import rules from a file |
|
527 | # import rules from a file | |
529 |
newrules = opts.get( |
|
528 | newrules = opts.get('import_rules') | |
530 | if newrules: |
|
529 | if newrules: | |
531 | try: |
|
530 | try: | |
532 | filepath = os.path.join(encoding.getcwd(), newrules) |
|
531 | filepath = os.path.join(encoding.getcwd(), newrules) | |
@@ -546,16 +545,16 b' def trackedcmd(ui, repo, remotepath=None' | |||||
546 | b"is not supported in narrowspec" |
|
545 | b"is not supported in narrowspec" | |
547 | ) |
|
546 | ) | |
548 | ) |
|
547 | ) | |
549 |
opts[ |
|
548 | opts['addinclude'].extend(includepats) | |
550 |
opts[ |
|
549 | opts['addexclude'].extend(excludepats) | |
551 |
|
550 | |||
552 |
addedincludes = narrowspec.parsepatterns(opts[ |
|
551 | addedincludes = narrowspec.parsepatterns(opts['addinclude']) | |
553 |
removedincludes = narrowspec.parsepatterns(opts[ |
|
552 | removedincludes = narrowspec.parsepatterns(opts['removeinclude']) | |
554 |
addedexcludes = narrowspec.parsepatterns(opts[ |
|
553 | addedexcludes = narrowspec.parsepatterns(opts['addexclude']) | |
555 |
removedexcludes = narrowspec.parsepatterns(opts[ |
|
554 | removedexcludes = narrowspec.parsepatterns(opts['removeexclude']) | |
556 |
autoremoveincludes = opts[ |
|
555 | autoremoveincludes = opts['auto_remove_includes'] | |
557 |
|
556 | |||
558 |
update_working_copy = opts[ |
|
557 | update_working_copy = opts['update_working_copy'] | |
559 | only_show = not ( |
|
558 | only_show = not ( | |
560 | addedincludes |
|
559 | addedincludes | |
561 | or removedincludes |
|
560 | or removedincludes | |
@@ -570,7 +569,7 b' def trackedcmd(ui, repo, remotepath=None' | |||||
570 | if only_show: |
|
569 | if only_show: | |
571 | oldincludes, oldexcludes = repo.narrowpats |
|
570 | oldincludes, oldexcludes = repo.narrowpats | |
572 | ui.pager(b'tracked') |
|
571 | ui.pager(b'tracked') | |
573 | fm = ui.formatter(b'narrow', opts) |
|
572 | fm = ui.formatter(b'narrow', pycompat.byteskwargs(opts)) | |
574 | for i in sorted(oldincludes): |
|
573 | for i in sorted(oldincludes): | |
575 | fm.startitem() |
|
574 | fm.startitem() | |
576 | fm.write(b'status', b'%s ', b'I', label=b'narrow.included') |
|
575 | fm.write(b'status', b'%s ', b'I', label=b'narrow.included') | |
@@ -614,7 +613,7 b' def trackedcmd(ui, repo, remotepath=None' | |||||
614 | # also define the set of revisions to update for widening. |
|
613 | # also define the set of revisions to update for widening. | |
615 | path = urlutil.get_unique_pull_path_obj(b'tracked', ui, remotepath) |
|
614 | path = urlutil.get_unique_pull_path_obj(b'tracked', ui, remotepath) | |
616 | ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(path.loc)) |
|
615 | ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(path.loc)) | |
617 | remote = hg.peer(repo, opts, path) |
|
616 | remote = hg.peer(repo, pycompat.byteskwargs(opts), path) | |
618 |
|
617 | |||
619 | try: |
|
618 | try: | |
620 | # check narrow support before doing anything if widening needs to be |
|
619 | # check narrow support before doing anything if widening needs to be | |
@@ -670,8 +669,8 b' def trackedcmd(ui, repo, remotepath=None' | |||||
670 | oldexcludes, |
|
669 | oldexcludes, | |
671 | newincludes, |
|
670 | newincludes, | |
672 | newexcludes, |
|
671 | newexcludes, | |
673 |
opts[ |
|
672 | opts['force_delete_local_changes'], | |
674 |
opts[ |
|
673 | opts['backup'], | |
675 | ) |
|
674 | ) | |
676 | # _narrow() updated the narrowspec and _widen() below needs to |
|
675 | # _narrow() updated the narrowspec and _widen() below needs to | |
677 | # use the updated values as its base (otherwise removed includes |
|
676 | # use the updated values as its base (otherwise removed includes |
General Comments 0
You need to be logged in to leave comments.
Login now