##// END OF EJS Templates
fetch: migrate `opts` to native kwargs
Matt Harbison -
r51769:eeffc968 default
parent child Browse files
Show More
@@ -74,10 +74,9 b" def fetch(ui, repo, source=b'default', *"
74 Returns 0 on success.
74 Returns 0 on success.
75 """
75 """
76
76
77 opts = pycompat.byteskwargs(opts)
77 date = opts.get('date')
78 date = opts.get(b'date')
79 if date:
78 if date:
80 opts[b'date'] = dateutil.parsedate(date)
79 opts['date'] = dateutil.parsedate(date)
81
80
82 parent = repo.dirstate.p1()
81 parent = repo.dirstate.p1()
83 branch = repo.dirstate.branch()
82 branch = repo.dirstate.branch()
@@ -109,12 +108,12 b" def fetch(ui, repo, source=b'default', *"
109 )
108 )
110
109
111 path = urlutil.get_unique_pull_path_obj(b'fetch', ui, source)
110 path = urlutil.get_unique_pull_path_obj(b'fetch', ui, source)
112 other = hg.peer(repo, opts, path)
111 other = hg.peer(repo, pycompat.byteskwargs(opts), path)
113 ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(path.loc))
112 ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(path.loc))
114 revs = None
113 revs = None
115 if opts[b'rev']:
114 if opts['rev']:
116 try:
115 try:
117 revs = [other.lookup(rev) for rev in opts[b'rev']]
116 revs = [other.lookup(rev) for rev in opts['rev']]
118 except error.CapabilityError:
117 except error.CapabilityError:
119 err = _(
118 err = _(
120 b"other repository doesn't support revision lookup, "
119 b"other repository doesn't support revision lookup, "
@@ -162,7 +161,7 b" def fetch(ui, repo, source=b'default', *"
162 # By default, we consider the repository we're pulling
161 # By default, we consider the repository we're pulling
163 # *from* as authoritative, so we merge our changes into
162 # *from* as authoritative, so we merge our changes into
164 # theirs.
163 # theirs.
165 if opts[b'switch_parent']:
164 if opts['switch_parent']:
166 firstparent, secondparent = newparent, newheads[0]
165 firstparent, secondparent = newparent, newheads[0]
167 else:
166 else:
168 firstparent, secondparent = newheads[0], newparent
167 firstparent, secondparent = newheads[0], newparent
@@ -179,14 +178,12 b" def fetch(ui, repo, source=b'default', *"
179
178
180 if not err:
179 if not err:
181 # we don't translate commit messages
180 # we don't translate commit messages
182 message = cmdutil.logmessage(ui, opts) or (
181 message = cmdutil.logmessage(ui, pycompat.byteskwargs(opts)) or (
183 b'Automated merge with %s' % urlutil.removeauth(other.url())
182 b'Automated merge with %s' % urlutil.removeauth(other.url())
184 )
183 )
185 editopt = opts.get(b'edit') or opts.get(b'force_editor')
184 editopt = opts.get('edit') or opts.get('force_editor')
186 editor = cmdutil.getcommiteditor(edit=editopt, editform=b'fetch')
185 editor = cmdutil.getcommiteditor(edit=editopt, editform=b'fetch')
187 n = repo.commit(
186 n = repo.commit(message, opts['user'], opts['date'], editor=editor)
188 message, opts[b'user'], opts[b'date'], editor=editor
189 )
190 ui.status(
187 ui.status(
191 _(b'new changeset %d:%s merges remote changes with local\n')
188 _(b'new changeset %d:%s merges remote changes with local\n')
192 % (repo.changelog.rev(n), short(n))
189 % (repo.changelog.rev(n), short(n))
General Comments 0
You need to be logged in to leave comments. Login now