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