uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
f9f8003e7f9aa38118182dbc
train
function
def bigger_edge(img): y, x = img.shape return y if y < x else x
def bigger_edge(img):
y, x = img.shape return y if y < x else x
center sizexsize of the image" y, x = img.shape startx = (x - size) // 2 starty = (y - size) // 2 return img[starty:starty+size, startx:startx+size] def bigger_edge(img):
64
64
23
5
59
Dani-97/tbcnn
preprocess.py
Python
bigger_edge
bigger_edge
19
21
19
19
f96d2f9114c71f334839654d700f912f6eb9d16f
bigcode/the-stack
train
05ad1a1648b860b86f58a5d8
train
function
def preprocess(inDir, outDir, size=512): "Preprocess files, resizing them to sizexsize pixels and removing black borders" # Ensure output folder exists if not os.path.exists(outDir): os.mkdir(outDir) files = sorted(os.listdir(inDir)) num = len(files) if num == 0: print("Pl...
def preprocess(inDir, outDir, size=512):
"Preprocess files, resizing them to sizexsize pixels and removing black borders" # Ensure output folder exists if not os.path.exists(outDir): os.mkdir(outDir) files = sorted(os.listdir(inDir)) num = len(files) if num == 0: print("Please put the images into the data folder....
ix_(mask.any(1), mask.any(0))] def crop_center(img, size): "Crop center sizexsize of the image" y, x = img.shape startx = (x - size) // 2 starty = (y - size) // 2 return img[starty:starty+size, startx:startx+size] def bigger_edge(img): y, x = img.shape return y if y < x else x def preproc...
117
117
391
12
104
Dani-97/tbcnn
preprocess.py
Python
preprocess
preprocess
23
69
23
23
bd6f70b0a85d40afd31c593d5575a483acace53e
bigcode/the-stack
train
b81bc48b75078674b1f11928
train
class
class RequireSubCommand: no_launch = True
class RequireSubCommand:
no_launch = True
_launch: parser.set_defaults(func=instance) return instance def __call__(self, *args): self.args = args[0] if len(args) else None self.launch() def launch(self): if self.parser: self.parser.print_help() class RequireSubCommand:
64
64
11
5
59
maryayi/restfulpy
restfulpy/cli/launchers.py
Python
RequireSubCommand
RequireSubCommand
29
30
29
29
3497370e24a67b55e49934d095fb9a78d51319e6
bigcode/the-stack
train
bf26e44896f0e56f0c8c6c32
train
class
class Launcher: no_launch = False parser = None @classmethod def create_parser(cls, subparsers): raise NotImplementedError @classmethod def register(cls, subparsers): parser = cls.create_parser(subparsers) instance = cls() instance.parser = parser if not...
class Launcher:
no_launch = False parser = None @classmethod def create_parser(cls, subparsers): raise NotImplementedError @classmethod def register(cls, subparsers): parser = cls.create_parser(subparsers) instance = cls() instance.parser = parser if not cls.no_launch: ...
class Launcher:
3
64
132
3
0
maryayi/restfulpy
restfulpy/cli/launchers.py
Python
Launcher
Launcher
3
26
3
3
42de610721afb011d551df13965670bc3588b5dc
bigcode/the-stack
train
31e2c488be7b9db6cc1b307d
train
class
class Transducer: def __init__(self): pass def step(self, v): return v # return the transformed value def complete(self): """Can optionally return a final value """ pass
class Transducer:
def __init__(self): pass def step(self, v): return v # return the transformed value def complete(self): """Can optionally return a final value """ pass
on_next is called. It implements a function f: Input X State -> Output X State For those who speak automata, this is a Mealy machine. """ from collections import deque from statistics import median from antevents.base import Publisher, Filter, SensorEvent, filtermethod class Transducer:
64
64
49
4
59
mpi-sws-rse/antevents-python
antevents/linq/transducer.py
Python
Transducer
Transducer
16
25
16
16
a429ec4837393646101b845ec7812c2b72061be7
bigcode/the-stack
train
bffdf3e080e6ce52e5d6d503
train
class
class SlidingWindowTransducer(Transducer): """Transducer that processses a sliding window of events. The most recent history_samples events are kept internally in a deque. When an event arrives, it is pushed onto the deque and an old event is popped off. There are three cases: the very first event, even...
class SlidingWindowTransducer(Transducer):
"""Transducer that processses a sliding window of events. The most recent history_samples events are kept internally in a deque. When an event arrives, it is pushed onto the deque and an old event is popped off. There are three cases: the very first event, events before the buffer is full, and event...
the # step() call. Don't call _dispatch_error here(), as it will result # in it being called twice. TODO: This is somewhat error prone - need to # think through tis a bit more. x_prime = xform.step(x) if x_prime is not None: self._dispatch_next(x_prime) def on_c...
162
162
541
9
153
mpi-sws-rse/antevents-python
antevents/linq/transducer.py
Python
SlidingWindowTransducer
SlidingWindowTransducer
61
116
61
61
95c194170e982461f5c5d3e7a8217ff8196733f7
bigcode/the-stack
train
8bbb04b06af36389f36c3143
train
class
class SensorSlidingMean(SlidingWindowTransducer): """Given a stream of SensorEvents, output a new event representing the mean of the event values in the window. The state we keep is the sum of the .val fields within the window. We assume that all events are from the same sensor. """ def __init__...
class SensorSlidingMean(SlidingWindowTransducer):
"""Given a stream of SensorEvents, output a new event representing the mean of the event values in the window. The state we keep is the sum of the .val fields within the window. We assume that all events are from the same sensor. """ def __init__(self, history_samples): super().__init__(...
old_event, total_events): """Called when the buffer is full. We are evicting old_event to make room for new_event. The total size of the buffer will then be total_events. Should return a pair consisting of the output event and new state. """ raise NotImplemented class Se...
78
78
261
11
66
mpi-sws-rse/antevents-python
antevents/linq/transducer.py
Python
SensorSlidingMean
SensorSlidingMean
119
146
119
119
72bfc95cb02d09adcaaaaac5b4eaeeac7456f6f5
bigcode/the-stack
train
85a1eb4ec123daa4ef9ab98d
train
class
class PeriodicMedianTransducer(Transducer): """Emit an event once every ``period`` input events. The value is the median of the inputs received since the last emission. """ def __init__(self, period=5): self.period = period self.samples = [None for i in range(period)] self.ev...
class PeriodicMedianTransducer(Transducer):
"""Emit an event once every ``period`` input events. The value is the median of the inputs received since the last emission. """ def __init__(self, period=5): self.period = period self.samples = [None for i in range(period)] self.events_since_last = 0 self.last_event ...
_events) return (new_event, new_state) def _replace_event(self, state, new_event, old_event, total_events): new_state = state + new_event.val - old_event.val new_event = SensorEvent(sensor_id=new_event.sensor_id, ts=new_event.ts, ...
112
112
374
10
101
mpi-sws-rse/antevents-python
antevents/linq/transducer.py
Python
PeriodicMedianTransducer
PeriodicMedianTransducer
149
190
149
149
ebe4cac870987f301423e49dba4e82b1f8d9237c
bigcode/the-stack
train
df9c436b00ecd67c7d0293cd
train
function
@filtermethod(Publisher) def transduce(this, xform): """Execute a (stateful) transducer to transform the event sequence. The transducer provides a step() method to accept a value and return the transformation. If the step() returns None, no output event is emitted Keyword arguments: :param Tran...
@filtermethod(Publisher) def transduce(this, xform):
"""Execute a (stateful) transducer to transform the event sequence. The transducer provides a step() method to accept a value and return the transformation. If the step() returns None, no output event is emitted Keyword arguments: :param Transducer transducer: A transducer to execute. :ret...
from statistics import median from antevents.base import Publisher, Filter, SensorEvent, filtermethod class Transducer: def __init__(self): pass def step(self, v): return v # return the transformed value def complete(self): """Can optionally return a final value """ ...
84
84
280
14
69
mpi-sws-rse/antevents-python
antevents/linq/transducer.py
Python
transduce
transduce
27
58
27
28
ce59221db9311bac42c96e7efb4a35a459c82110
bigcode/the-stack
train
e3ca04a9cfd107e92116f4c2
train
function
@pytest.mark.skipif(not _COCO_AVAILABLE, reason="pycocotools is not installed for testing") def test_detection(tmpdir): train_folder, coco_ann_path = _create_synth_coco_dataset(tmpdir) data = ObjectDetectionData.from_coco(train_folder=train_folder, train_ann_file=coco_ann_path, batch_size=1) model = Objec...
@pytest.mark.skipif(not _COCO_AVAILABLE, reason="pycocotools is not installed for testing") def test_detection(tmpdir):
train_folder, coco_ann_path = _create_synth_coco_dataset(tmpdir) data = ObjectDetectionData.from_coco(train_folder=train_folder, train_ann_file=coco_ann_path, batch_size=1) model = ObjectDetector(num_classes=data.num_classes) trainer = flash.Trainer(fast_dev_run=True) trainer.finetune(model, data...
_dataset _COCO_AVAILABLE = _module_available("pycocotools") if _COCO_AVAILABLE: from pycocotools.coco import COCO @pytest.mark.skipif(not _COCO_AVAILABLE, reason="pycocotools is not installed for testing") def test_detection(tmpdir):
64
64
195
29
34
alvin-chang/lightning-flash
tests/vision/detection/test_data_model_integration.py
Python
test_detection
test_detection
30
50
30
32
22b0f30351186a93914da942caeb634e4a75ebb9
bigcode/the-stack
train
102868f320b52b33ab5e1201
train
function
def findrepo(p): while not os.path.isdir(os.path.join(p, ".hg")): oldp, p = p, os.path.dirname(p) if p == oldp: return None return p
def findrepo(p):
while not os.path.isdir(os.path.join(p, ".hg")): oldp, p = p, os.path.dirname(p) if p == oldp: return None return p
choice: return choice[cmd] if len(choice) > 1: clist = sorted(choice) raise error.AmbiguousCommand(cmd, clist) if choice: return list(choice.values())[0] raise error.UnknownCommand(cmd, allcmds) def findrepo(p):
64
64
48
5
59
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
findrepo
findrepo
736
742
736
736
0b240fe29b4e9e21b84135d03fa82db677b4d3ec
bigcode/the-stack
train
c894f32d4857e586e738a454
train
class
class command(registrar.command): def _doregister(self, func, name, *args, **kwargs): func._deprecatedregistrar = True # flag for deprecwarn in extensions.py return super(command, self)._doregister(func, name, *args, **kwargs)
class command(registrar.command):
def _doregister(self, func, name, *args, **kwargs): func._deprecatedregistrar = True # flag for deprecwarn in extensions.py return super(command, self)._doregister(func, name, *args, **kwargs)
(f) copied = copies.pathcopies(repo[parent], ctx) for f in actions['add'][0] + actions['undelete'][0] + actions['revert'][0]: if f in copied: repo.dirstate.copy(copied[f], f) class command(registrar.command):
64
64
63
6
58
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
command
command
3,759
3,762
3,759
3,759
186a9c11b71eb0c84f2cdccda41eb35098d10486
bigcode/the-stack
train
358aef7de5192b2023af9794
train
function
def _commentlines(raw): '''Surround lineswith a comment char and a new line''' lines = raw.splitlines() commentedlines = ['# %s' % line for line in lines] return '\n'.join(commentedlines) + '\n'
def _commentlines(raw):
'''Surround lineswith a comment char and a new line''' lines = raw.splitlines() commentedlines = ['# %s' % line for line in lines] return '\n'.join(commentedlines) + '\n'
# If nothing is changed, make sure the order of files is preserved. if not didsomethingchanged: return statlist for x in range(len(indexes)): if not finalrs[x]: finalrs[x] = statlist[x] return finalrs def _commentlines(raw):
64
64
57
6
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_commentlines
_commentlines
576
580
576
576
642e3058ac0944812be1e3ca3ec3085254fe1a18
bigcode/the-stack
train
d3290177dcdd68e4ad455c9c
train
function
def howtocontinue(repo): '''Check for an unfinished operation and return the command to finish it. afterresolvedstates tuples define a .hg/{file} and the corresponding command needed to finish it. Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is a boolean. ''' contmsg...
def howtocontinue(repo):
'''Check for an unfinished operation and return the command to finish it. afterresolvedstates tuples define a .hg/{file} and the corresponding command needed to finish it. Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is a boolean. ''' contmsg = _("continue: %s") ...
for f, clearable, allowcommit, msg, hint in unfinishedstates: if clearable and repo.vfs.exists(f): util.unlink(repo.vfs.join(f)) afterresolvedstates = [ ('graftstate', _('hg graft --continue')), ] def howtocontinue(repo):
64
64
146
7
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
howtocontinue
howtocontinue
3,820
3,836
3,820
3,820
94a3c65da9ef12c24f620754ca32b9fcf4b766d2
bigcode/the-stack
train
74ba13c7a3a884bf2f004658
train
function
def add(ui, repo, match, prefix, explicitonly, **opts): join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) names = [] wctx = repo[None] cca = None abort, warn = scmutil.checkportabilityalert(ui) if abort or warn: cca = scmutil...
def add(ui, repo, match, prefix, explicitonly, **opts):
join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) names = [] wctx = repo[None] cca = None abort, warn = scmutil.checkportabilityalert(ui) if abort or warn: cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate) bad...
, filematcher) def checkunsupportedgraphflags(pats, opts): for op in ["newest_first"]: if op in opts and opts[op]: raise error.Abort(_("-G/--graph option is incompatible with --%s") % op.replace("_", "-")) def graphrevs(repo, nodes, opts): limi...
121
121
405
16
105
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
add
add
2,699
2,740
2,699
2,699
8a85e89089db6b491710faeab1e0a47685ec148c
bigcode/the-stack
train
a40a57e2807b3ebd87185ccc
train
function
def checkunsupportedgraphflags(pats, opts): for op in ["newest_first"]: if op in opts and opts[op]: raise error.Abort(_("-G/--graph option is incompatible with --%s") % op.replace("_", "-"))
def checkunsupportedgraphflags(pats, opts):
for op in ["newest_first"]: if op in opts and opts[op]: raise error.Abort(_("-G/--graph option is incompatible with --%s") % op.replace("_", "-"))
=endrev) ui.pager('log') displayer = show_changeset(ui, repo, opts, buffered=True) displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges, getrenamed, filematcher) def checkunsupportedgraphflags(pats, opts):
64
64
56
10
54
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
checkunsupportedgraphflags
checkunsupportedgraphflags
2,686
2,690
2,686
2,686
fac2dd4b80ea96dfb5d8f2db803e1e0459dd1630
bigcode/the-stack
train
680043ee0263a5e2361a9f7a
train
function
def _graphnodeformatter(ui, displayer): spec = ui.config('ui', 'graphnodetemplate') if not spec: return templatekw.showgraphnode # fast path for "{graphnode}" spec = templater.unquotestring(spec) templ = formatter.maketemplater(ui, spec) cache = {} if isinstance(displayer, changeset_te...
def _graphnodeformatter(ui, displayer):
spec = ui.config('ui', 'graphnodetemplate') if not spec: return templatekw.showgraphnode # fast path for "{graphnode}" spec = templater.unquotestring(spec) templ = formatter.maketemplater(ui, spec) cache = {} if isinstance(displayer, changeset_templater): cache = displayer.cach...
revs = [] for idx, r in enumerate(revs): if limit <= idx: break limitedrevs.append(r) revs = smartset.baseset(limitedrevs) return revs, expr, filematcher def _graphnodeformatter(ui, displayer):
64
64
175
10
53
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_graphnodeformatter
_graphnodeformatter
2,596
2,615
2,596
2,596
838aaad5c8c6386a271a2d53e6dec02cb55d726b
bigcode/the-stack
train
bd21295cb029b97133785e78
train
function
def setupwrapcolorwrite(ui): # wrap ui.write so diff output can be labeled/colorized def wrapwrite(orig, *args, **kw): label = kw.pop('label', '') for chunk, l in patch.difflabel(lambda: args): orig(chunk, label=label + l) oldwrite = ui.write def wrap(*args, **kwargs): ...
def setupwrapcolorwrite(ui): # wrap ui.write so diff output can be labeled/colorized
def wrapwrite(orig, *args, **kw): label = kw.pop('label', '') for chunk, l in patch.difflabel(lambda: args): orig(chunk, label=label + l) oldwrite = ui.write def wrap(*args, **kwargs): return wrapwrite(oldwrite, *args, **kwargs) setattr(ui, 'write', wrap) return ...
and chunk not in \ originalchunks: newlyaddedandmodifiedfiles.add(chunk.header.filename()) return newlyaddedandmodifiedfiles def parsealiases(cmd): return cmd.lstrip("^").split("|") def setupwrapcolorwrite(ui): # wrap ui.write so diff output can be labeled/colorized
64
64
110
21
43
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
setupwrapcolorwrite
setupwrapcolorwrite
178
189
178
179
5dbac875a7bf19c11460ea4d3f98f7e46210fc17
bigcode/the-stack
train
3e7a8c7ad7528060ac4d46f4
train
function
def files(ui, ctx, m, fm, fmt, subrepos): rev = ctx.rev() ret = 1 ds = ctx.repo().dirstate for f in ctx.matches(m): if rev is None and ds[f] == 'r': continue fm.startitem() if ui.verbose: fc = ctx[f] fm.write('size flags', '% 10d % 1s ', fc.si...
def files(ui, ctx, m, fm, fmt, subrepos):
rev = ctx.rev() ret = 1 ds = ctx.repo().dirstate for f in ctx.matches(m): if rev is None and ds[f] == 'r': continue fm.startitem() if ui.verbose: fc = ctx[f] fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) fm.data(abspath=...
.status(_('removing %s\n') % match.rel(f)) rejected = wctx.forget(forget, prefix) bad.extend(f for f in rejected if f in match.files()) forgot.extend(f for f in forget if f not in rejected) return bad, forgot def files(ui, ctx, m, fm, fmt, subrepos):
74
74
249
15
58
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
files
files
2,799
2,827
2,799
2,799
5c3dd24a689380d3fa5d0992d402b3445105732a
bigcode/the-stack
train
027568b546885cd9f3dcc983
train
class
class changeset_printer(object): '''show changeset information when templating not requested.''' def __init__(self, ui, repo, matchfn, diffopts, buffered): self.ui = ui self.repo = repo self.buffered = buffered self.matchfn = matchfn self.diffopts = diffopts self...
class changeset_printer(object):
'''show changeset information when templating not requested.''' def __init__(self, ui, repo, matchfn, diffopts, buffered): self.ui = ui self.repo = repo self.buffered = buffered self.matchfn = matchfn self.diffopts = diffopts self.header = {} self.hunk = ...
2] for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): tempnode2 = node2 try: if node2 is not None: tempnode2 = ctx2.substate[subpath][1] except KeyError: # A subrepo that existed in node1 was deleted between node1 and ...
256
256
1,608
7
249
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
changeset_printer
changeset_printer
1,580
1,763
1,580
1,580
b28f37748373a282cbdbcc8a779bf21e560a6ced
bigcode/the-stack
train
de042a83f33484afa973c09b
train
function
def commitstatus(repo, node, branch, bheads=None, opts=None): if opts is None: opts = {} ctx = repo[node] parents = ctx.parents() if (not opts.get('amend') and bheads and node not in bheads and not [x for x in parents if x.node() in bheads and x.branch() == branch]): repo.ui.sta...
def commitstatus(repo, node, branch, bheads=None, opts=None):
if opts is None: opts = {} ctx = repo[node] parents = ctx.parents() if (not opts.get('amend') and bheads and node not in bheads and not [x for x in parents if x.node() in bheads and x.branch() == branch]): repo.ui.status(_('created new head\n')) # The message is not prin...
repo._activebookmark)) edittext.extend([hgprefix(_("subrepo %s") % s) for s in subs]) edittext.extend([hgprefix(_("added %s") % f) for f in added]) edittext.extend([hgprefix(_("changed %s") % f) for f in modified]) edittext.extend([hgprefix(_("removed %s") % f) for f in removed]) if not added and n...
140
140
468
16
124
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
commitstatus
commitstatus
3,283
3,329
3,283
3,283
51c409ea9f43cfd99f762f102f4c18740e41af8d
bigcode/the-stack
train
2ccbdb97ae8d49ab576bd606
train
function
def _logrevs(repo, opts): # Default --rev value depends on --follow but --follow behavior # depends on revisions resolved from --rev... follow = opts.get('follow') or opts.get('follow_first') if opts.get('rev'): revs = scmutil.revrange(repo, opts['rev']) elif follow and repo.dirstate.p1() ==...
def _logrevs(repo, opts): # Default --rev value depends on --follow but --follow behavior # depends on revisions resolved from --rev...
follow = opts.get('follow') or opts.get('follow_first') if opts.get('rev'): revs = scmutil.revrange(repo, opts['rev']) elif follow and repo.dirstate.p1() == nullid: revs = smartset.baseset() elif follow: revs = repo.revs('reverse(:.)') else: revs = smartset.spanset(re...
: expr = '(' + ' and '.join(expr) + ')' else: expr = None return expr, filematcher def _logrevs(repo, opts): # Default --rev value depends on --follow but --follow behavior # depends on revisions resolved from --rev...
64
64
135
34
29
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_logrevs
_logrevs
2,524
2,537
2,524
2,526
e313ef68f94178f87827a74275cf4e278204c558
bigcode/the-stack
train
b5009e8893068189641c3fe1
train
function
def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc): """Utility function used by commands.import to import a single patch This function is explicitly defined here to help the evolve extension to wrap this part of the import logic. The API is currently a bit ugly because it a simple code ...
def tryimportone(ui, repo, hunk, parents, opts, msgs, updatefunc):
"""Utility function used by commands.import to import a single patch This function is explicitly defined here to help the evolve extension to wrap this part of the import logic. The API is currently a bit ugly because it a simple code translation from the import command. Feel free to make it bette...
ui.warn(_('(consider using --after)\n')) return errors != 0 ## facility to let extension process additional data into an import patch # list of identifier to be executed in order extrapreimport = [] # run before commit extrapostimport = [] # run after commit # mapping from identifier to actual import fun...
256
256
1,406
20
236
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
tryimportone
tryimportone
1,243
1,411
1,243
1,243
d53548f1d8cfa09b0539698fdc2e773df696ec2d
bigcode/the-stack
train
111c0d092322c23f2c5e73c3
train
function
def addwebdirpath(repo, serverpath, webconf): webconf[serverpath] = repo.root repo.ui.debug('adding %s = %s\n' % (serverpath, repo.root)) for r in repo.revs('filelog("path:.hgsub")'): ctx = repo[r] for subpath in ctx.substate: ctx.sub(subpath).addwebdirpath(serverpath, webconf)
def addwebdirpath(repo, serverpath, webconf):
webconf[serverpath] = repo.root repo.ui.debug('adding %s = %s\n' % (serverpath, repo.root)) for r in repo.revs('filelog("path:.hgsub")'): ctx = repo[r] for subpath in ctx.substate: ctx.sub(subpath).addwebdirpath(serverpath, webconf)
subrepository: %s\n") % join(subpath)) if not opts.get(r'dry_run'): rejected = wctx.add(names, prefix) bad.extend(f for f in rejected if f in match.files()) return bad def addwebdirpath(repo, serverpath, webconf):
64
64
93
13
50
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
addwebdirpath
addwebdirpath
2,742
2,749
2,742
2,742
7e01df489cc91066c6d1c107190fb904f1e8b340
bigcode/the-stack
train
3dcccc6990b24df3232c5bbc
train
function
def copy(ui, repo, pats, opts, rename=False): # called with the repo lock held # # hgsep => pathname that uses "/" to separate directories # ossep => pathname that uses os.sep to separate directories cwd = repo.getcwd() targets = {} after = opts.get("after") dryrun = opts.get("dry_run") ...
def copy(ui, repo, pats, opts, rename=False): # called with the repo lock held # # hgsep => pathname that uses "/" to separate directories # ossep => pathname that uses os.sep to separate directories
cwd = repo.getcwd() targets = {} after = opts.get("after") dryrun = opts.get("dry_run") wctx = repo[None] def walkpat(pat): srcs = [] if after: badstates = '?' else: badstates = '?r' m = scmutil.match(wctx, [pat], opts, globbed=True) ...
if repo: if cl: r = repo.unfiltered().changelog elif dir: if 'treemanifest' not in repo.requirements: raise error.Abort(_("--dir can only be used on repos with " "treemanifest enabled")) dirlog = repo.manifestlog._re...
256
256
2,124
51
204
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
copy
copy
976
1,220
976
980
fc4d93078c9ea140b887e868ba7878505072ce3d
bigcode/the-stack
train
71befdae9a8d922e42e66c80
train
class
class _followfilter(object): def __init__(self, repo, onlyfirst=False): self.repo = repo self.startrev = nullrev self.roots = set() self.onlyfirst = onlyfirst def match(self, rev): def realparents(rev): if self.onlyfirst: return self.repo.chan...
class _followfilter(object):
def __init__(self, repo, onlyfirst=False): self.repo = repo self.startrev = nullrev self.roots = set() self.onlyfirst = onlyfirst def match(self, rev): def realparents(rev): if self.onlyfirst: return self.repo.changelog.parentrevs(rev)[0:1] ...
if rev not in ancestors: continue # XXX insert 1327 fix here if flparentlinkrevs: ancestors.update(flparentlinkrevs) fncache.setdefault(rev, []).append(file_) wanted.add(rev) if copied: ...
75
75
252
6
68
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_followfilter
_followfilter
2,165
2,200
2,165
2,165
c5bbfaae3e00b95c513dbd62c09242fd5a283ec5
bigcode/the-stack
train
57aa1721c40d97eda00ba1d9
train
function
def walkfilerevs(repo, match, follow, revs, fncache): '''Walks the file history for the matched files. Returns the changeset revs that are involved in the file history. Throws FileWalkError if the file history can't be walked using filelogs alone. ''' wanted = set() copies = [] minrev,...
def walkfilerevs(repo, match, follow, revs, fncache):
'''Walks the file history for the matched files. Returns the changeset revs that are involved in the file history. Throws FileWalkError if the file history can't be walked using filelogs alone. ''' wanted = set() copies = [] minrev, maxrev = min(revs), max(revs) def filerevgen(file...
') def finddate(ui, repo, date): """Find the tipmost changeset that matches the given date spec""" df = util.matchdate(date) m = scmutil.matchall(repo) results = {} def prep(ctx, fns): d = ctx.date() if df(d[0]): results[ctx.rev()] = d for ctx in walkchangerevs(re...
219
219
730
17
201
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
walkfilerevs
walkfilerevs
2,068
2,163
2,068
2,068
2b5023f1afe5df9f4299243c261133f50eded629
bigcode/the-stack
train
d387626ca093fb3ebc23e08c
train
function
def forget(ui, repo, match, prefix, explicitonly): join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) wctx = repo[None] forgot = [] s = repo.status(match=matchmod.badmatch(match, badfn), clean=True) forget = sorted(s.modified + s.added + ...
def forget(ui, repo, match, prefix, explicitonly):
join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) wctx = repo[None] forgot = [] s = repo.status(match=matchmod.badmatch(match, badfn), clean=True) forget = sorted(s.modified + s.added + s.deleted + s.clean) if explicitonly: f...
_run'): rejected = wctx.add(names, prefix) bad.extend(f for f in rejected if f in match.files()) return bad def addwebdirpath(repo, serverpath, webconf): webconf[serverpath] = repo.root repo.ui.debug('adding %s = %s\n' % (serverpath, repo.root)) for r in repo.revs('filelog("path:.hgsub...
136
136
454
13
123
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
forget
forget
2,751
2,797
2,751
2,751
a0856852cd0482aec21822d77a2301ec66658e20
bigcode/the-stack
train
ed21757422d84bab31b9dc1f
train
function
def bailifchanged(repo, merge=True, hint=None): """ enforce the precondition that working directory must be clean. 'merge' can be set to false if a pending uncommitted merge should be ignored (such as when 'update --check' runs). 'hint' is the usual hint given to Abort exception. """ if merge...
def bailifchanged(repo, merge=True, hint=None):
""" enforce the precondition that working directory must be clean. 'merge' can be set to false if a pending uncommitted merge should be ignored (such as when 'update --check' runs). 'hint' is the usual hint given to Abort exception. """ if merge and repo.dirstate.p2() != nullid: raise...
allcmds) def findrepo(p): while not os.path.isdir(os.path.join(p, ".hg")): oldp, p = p, os.path.dirname(p) if p == oldp: return None return p def bailifchanged(repo, merge=True, hint=None):
64
64
174
12
51
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
bailifchanged
bailifchanged
744
760
744
744
7acd2908747524123852ce750f548707cc6a89bc
bigcode/the-stack
train
250ce6e1b854639f43bd38a0
train
function
def _graftmsg(): # tweakdefaults requires `update` to have a rev hence the `.` return _helpmessage('hg graft --continue', _updatecleanmsg())
def _graftmsg(): # tweakdefaults requires `update` to have a rev hence the `.`
return _helpmessage('hg graft --continue', _updatecleanmsg())
def _updatecleanmsg(dest=None): warning = _('warning: this will discard uncommitted changes') return 'hg update --clean %s (%s)' % (dest or '.', warning) def _graftmsg(): # tweakdefaults requires `update` to have a rev hence the `.`
64
64
38
22
42
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_graftmsg
_graftmsg
624
626
624
625
f92b4f374c8b506b12f3aa1d04eeef4ed7017658
bigcode/the-stack
train
98595b57bc6da4ac10d182c3
train
function
def tersestatus(root, statlist, status, ignorefn, ignore): """ Returns a list of statuses with directory collapsed if all the files in the directory has the same status. """ def numfiles(dirname): """ Calculates the number of tracked files in a given directory which also inc...
def tersestatus(root, statlist, status, ignorefn, ignore):
""" Returns a list of statuses with directory collapsed if all the files in the directory has the same status. """ def numfiles(dirname): """ Calculates the number of tracked files in a given directory which also includes files which were removed or deleted. Considers ignore...
ate for realname, tmpname in backups.items(): ui.debug('restoring %r to %r\n' % (tmpname, realname)) if dirstate[realname] == 'n': # without normallookup, restoring timestamp # may cause partially committed files ...
256
256
1,317
15
241
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
tersestatus
tersestatus
404
574
404
404
c7f64647e817f9732890b9057286803713e82290
bigcode/the-stack
train
9e541d284531b4af424c63a7
train
function
def fileexistspredicate(filename): return lambda repo: repo.vfs.exists(filename)
def fileexistspredicate(filename):
return lambda repo: repo.vfs.exists(filename)
(): msg = _('To mark the changeset good: hg bisect --good\n' 'To mark the changeset bad: hg bisect --bad\n' 'To abort: hg bisect --reset\n') return _commentlines(msg) def fileexistspredicate(filename):
64
64
18
7
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
fileexistspredicate
fileexistspredicate
638
639
638
638
86c02f0132da14065e9d2c06c5aa8f6c353c0e4e
bigcode/the-stack
train
fef102088b0754ff1e8e8209
train
function
def increasingwindows(windowsize=8, sizelimit=512): while True: yield windowsize if windowsize < sizelimit: windowsize *= 2
def increasingwindows(windowsize=8, sizelimit=512):
while True: yield windowsize if windowsize < sizelimit: windowsize *= 2
in results: ui.status(_("found revision %s from %s\n") % (rev, util.datestr(results[rev]))) return '%d' % rev raise error.Abort(_("revision matching date not found")) def increasingwindows(windowsize=8, sizelimit=512):
64
64
40
15
49
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
increasingwindows
increasingwindows
2,059
2,063
2,059
2,059
fb2912ee4041e0c9863bb9b990d06e24be185475
bigcode/the-stack
train
349bc6458b2187ae12ff4715
train
function
def _rebasemsg(): return _helpmessage('hg rebase --continue', 'hg rebase --abort')
def _rebasemsg():
return _helpmessage('hg rebase --continue', 'hg rebase --abort')
merge conflicts.') return _commentlines(msg) def _helpmessage(continuecmd, abortcmd): msg = _('To continue: %s\n' 'To abort: %s') % (continuecmd, abortcmd) return _commentlines(msg) def _rebasemsg():
64
64
26
7
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_rebasemsg
_rebasemsg
611
612
611
611
8c7c39107846f84dba64b640135a9819202e642c
bigcode/the-stack
train
90d8ba94491078b6e2dcd1bf
train
function
def parsealiases(cmd): return cmd.lstrip("^").split("|")
def parsealiases(cmd):
return cmd.lstrip("^").split("|")
originalchunks): newlyaddedandmodifiedfiles = set() for chunk in chunks: if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \ originalchunks: newlyaddedandmodifiedfiles.add(chunk.header.filename()) return newlyaddedandmodifiedfiles def parsealiases(cmd):
64
64
15
5
58
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
parsealiases
parsealiases
175
176
175
175
f8bcb080a40f0e7cd88c25d34925f3594d5e6e79
bigcode/the-stack
train
46ef94682dac350438040207
train
function
def findcmd(cmd, table, strict=True): """Return (aliases, command table entry) for command string.""" choice, allcmds = findpossible(cmd, table, strict) if cmd in choice: return choice[cmd] if len(choice) > 1: clist = sorted(choice) raise error.AmbiguousCommand(cmd, clist) ...
def findcmd(cmd, table, strict=True):
"""Return (aliases, command table entry) for command string.""" choice, allcmds = findpossible(cmd, table, strict) if cmd in choice: return choice[cmd] if len(choice) > 1: clist = sorted(choice) raise error.AmbiguousCommand(cmd, clist) if choice: return list(choice...
.startswith("debug"): debugchoice[found] = (aliases, table[e]) else: choice[found] = (aliases, table[e]) if not choice and debugchoice: choice = debugchoice return choice, allcmds def findcmd(cmd, table, strict=True):
64
64
102
10
53
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
findcmd
findcmd
720
734
720
720
b3d702be14e3459b963d8d8d13e81dd7b76998ca
bigcode/the-stack
train
29f2d7f8124f376d6d95492c
train
function
def revert(ui, repo, ctx, parents, *pats, **opts): parent, p2 = parents node = ctx.node() mf = ctx.manifest() if node == p2: parent = p2 # need all matching names in dirstate and manifest of target rev, # so have to walk both. do not print errors if files exist in one # but not oth...
def revert(ui, repo, ctx, parents, *pats, **opts):
parent, p2 = parents node = ctx.node() mf = ctx.manifest() if node == p2: parent = p2 # need all matching names in dirstate and manifest of target rev, # so have to walk both. do not print errors if files exist in one # but not other. in both cases, filesets should be evaluated aga...
B N y additional branch root # C N y additional topo head # H N n usual case # # B B y weird additional branch root # C B y branch merge # H B n merge with named branch # # C C y additional head from merge # C H n merge with a head...
256
256
2,490
17
239
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
revert
revert
3,334
3,615
3,334
3,334
f8ad6d36737b7b87f868d7f2e7dd4d7b5dd6f19b
bigcode/the-stack
train
d8a301befd071b42bd2d7580
train
function
def _makefollowlogfilematcher(repo, files, followfirst): # When displaying a revision with --patch --follow FILE, we have # to know which file of the revision must be diffed. With # --follow, we want the names of the ancestors of FILE in the # revision, stored in "fcache". "fcache" is populated by #...
def _makefollowlogfilematcher(repo, files, followfirst): # When displaying a revision with --patch --follow FILE, we have # to know which file of the revision must be diffed. With # --follow, we want the names of the ancestors of FILE in the # revision, stored in "fcache". "fcache" is populated by #...
fcache = {} fcacheready = [False] pctx = repo['.'] def populate(): for fn in files: fctx = pctx[fn] fcache.setdefault(fctx.introrev(), set()).add(fctx.path()) for c in fctx.ancestors(followfirst=followfirst): fcache.setdefault(c.rev(), set())....
def _makefollowlogfilematcher(repo, files, followfirst): # When displaying a revision with --patch --follow FILE, we have # to know which file of the revision must be diffed. With # --follow, we want the names of the ancestors of FILE in the # revision, stored in "fcache". "fcache" is populated by #...
119
78
263
119
0
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_makefollowlogfilematcher
_makefollowlogfilematcher
2,340
2,366
2,340
2,347
d1450cd39237c93794db585b56f6a0bb390b82e6
bigcode/the-stack
train
1010552d92b6c20e6cfd2787
train
function
def makefilename(repo, pat, node, desc=None, total=None, seqno=None, revwidth=None, pathname=None): node_expander = { 'H': lambda: hex(node), 'R': lambda: str(repo.changelog.rev(node)), 'h': lambda: short(node), 'm': lambda: re.sub('[^\w]', '_', str(desc)) }...
def makefilename(repo, pat, node, desc=None, total=None, seqno=None, revwidth=None, pathname=None):
node_expander = { 'H': lambda: hex(node), 'R': lambda: str(repo.changelog.rev(node)), 'h': lambda: short(node), 'm': lambda: re.sub('[^\w]', '_', str(desc)) } expander = { '%': lambda: '%', 'b': lambda: os.path.basename(repo.root), } try: ...
def loglimit(opts): """get the log limit according to option -l/--limit""" limit = opts.get('limit') if limit: try: limit = int(limit) except ValueError: raise error.Abort(_('limit must be a positive integer')) if limit <= 0: raise error.Abort(_(...
117
117
393
27
89
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
makefilename
makefilename
843
887
843
844
539d2ed9e7c6aea42660ed23958035b9d62d25ed
bigcode/the-stack
train
db0c88dfd25e46996ac30c42
train
function
def amend(ui, repo, commitfunc, old, extra, pats, opts): # avoid cycle context -> subrepo -> cmdutil from . import context # amend will reuse the existing user if not specified, but the obsolete # marker creation requires that the current user's name is specified. if obsolete.isenabled(repo, obsole...
def amend(ui, repo, commitfunc, old, extra, pats, opts): # avoid cycle context -> subrepo -> cmdutil
from . import context # amend will reuse the existing user if not specified, but the obsolete # marker creation requires that the current user's name is specified. if obsolete.isenabled(repo, obsolete.createmarkersopt): ui.username() # raise exception if username not set ui.note(_('amendin...
util.match(repo[None], pats, opts) dsguard = None # extract addremove carefully -- this function can be called from a command # that doesn't support addremove if opts.get('addremove'): dsguard = dirstateguard.dirstateguard(repo, 'commit') with dsguard or util.nullcontextmanager(): i...
256
256
1,316
29
227
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
amend
amend
3,027
3,180
3,027
3,028
56c3dabf987264d03d4a0936264ca2433badca4b
bigcode/the-stack
train
73268853a71370f4264c2ef4
train
function
def logtemplatespec(tmpl, mapfile): if mapfile: return formatter.templatespec('changeset', tmpl, mapfile) else: return formatter.templatespec('', tmpl, None)
def logtemplatespec(tmpl, mapfile):
if mapfile: return formatter.templatespec('changeset', tmpl, mapfile) else: return formatter.templatespec('', tmpl, None)
(templater.stringify(self.t(key, **props))) self.showpatch(ctx, matchfn) if self._parts['footer']: if not self.footer: self.footer = templater.stringify( self.t(self._parts['footer'], **props)) def logtemplatespec(tmpl, mapfile):
64
64
42
10
54
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
logtemplatespec
logtemplatespec
1,952
1,956
1,952
1,952
6027a1e5b1f0590b4ccd70290c59567a1c8a54a6
bigcode/the-stack
train
ab7c63a17ee41ea3a0ffe21a
train
function
def _getrepostate(repo): # experimental config: commands.status.skipstates skip = set(repo.ui.configlist('commands', 'status.skipstates')) for state, statedetectionpredicate, msgfn in STATES: if state in skip: continue if statedetectionpredicate(repo): return (state, ...
def _getrepostate(repo): # experimental config: commands.status.skipstates
skip = set(repo.ui.configlist('commands', 'status.skipstates')) for state, statedetectionpredicate, msgfn in STATES: if state in skip: continue if statedetectionpredicate(repo): return (state, statedetectionpredicate, msgfn)
# be in a merge or update state (eg. rebase, histedit, graft, etc). # We want those to have priority. ('merge', _mergepredicate, _mergemsg), ) def _getrepostate(repo): # experimental config: commands.status.skipstates
64
64
75
18
46
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_getrepostate
_getrepostate
658
665
658
659
58b925dac5646d2c9de99171a69b09be45543b4b
bigcode/the-stack
train
84ce061daf4b65beb98c3971
train
function
def openrevlog(repo, cmd, file_, opts): """opens the changelog, manifest, a filelog or a given revlog""" cl = opts['changelog'] mf = opts['manifest'] dir = opts['dir'] msg = None if cl and mf: msg = _('cannot specify --changelog and --manifest at the same time') elif cl and dir: ...
def openrevlog(repo, cmd, file_, opts):
"""opens the changelog, manifest, a filelog or a given revlog""" cl = opts['changelog'] mf = opts['manifest'] dir = opts['dir'] msg = None if cl and mf: msg = _('cannot specify --changelog and --manifest at the same time') elif cl and dir: msg = _('cannot specify --changelog ...
isstdiofilename(pat): if writable: fp = repo.ui.fout else: fp = repo.ui.fin return _unclosablefile(fp) fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname) if modemap is not None: mode = modemap.get(fn, mode) if mode == 'wb':...
114
114
380
12
102
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
openrevlog
openrevlog
931
974
931
931
8397eed6cfe77061005dd242ade7d45e5be8e492
bigcode/the-stack
train
4e10653b3cfd3586f88f0235
train
function
def _histeditmsg(): return _helpmessage('hg histedit --continue', 'hg histedit --abort')
def _histeditmsg():
return _helpmessage('hg histedit --continue', 'hg histedit --abort')
To continue: %s\n' 'To abort: %s') % (continuecmd, abortcmd) return _commentlines(msg) def _rebasemsg(): return _helpmessage('hg rebase --continue', 'hg rebase --abort') def _histeditmsg():
64
64
25
6
58
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_histeditmsg
_histeditmsg
614
615
614
614
0680cde946d73c7f823213b97ee1747032f7bd27
bigcode/the-stack
train
6597bc0570b0dc056cf78c40
train
function
def _makelogrevset(repo, pats, opts, revs): """Return (expr, filematcher) where expr is a revset string built from log options and file patterns or None. If --stat or --patch are not passed filematcher is None. Otherwise it is a callable taking a revision number and returning a match objects filtering ...
def _makelogrevset(repo, pats, opts, revs):
"""Return (expr, filematcher) where expr is a revset string built from log options and file patterns or None. If --stat or --patch are not passed filematcher is None. Otherwise it is a callable taking a revision number and returning a match objects filtering the files to be detailed when displaying ...
of the ancestors of FILE in the # revision, stored in "fcache". "fcache" is populated by # reproducing the graph traversal already done by --follow revset # and relating revs to file names (which is not "correct" but # good enough). fcache = {} fcacheready = [False] pctx = repo['.'] de...
256
256
1,573
15
240
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_makelogrevset
_makelogrevset
2,372
2,522
2,372
2,372
2ba210c8c3b48df38f73731787fabfbb5d9adf19
bigcode/the-stack
train
2b33a962a37a8ef81c7b19d7
train
function
def _bisectmsg(): msg = _('To mark the changeset good: hg bisect --good\n' 'To mark the changeset bad: hg bisect --bad\n' 'To abort: hg bisect --reset\n') return _commentlines(msg)
def _bisectmsg():
msg = _('To mark the changeset good: hg bisect --good\n' 'To mark the changeset bad: hg bisect --bad\n' 'To abort: hg bisect --reset\n') return _commentlines(msg)
a rev hence the `.` return _helpmessage('hg graft --continue', _updatecleanmsg()) def _mergemsg(): # tweakdefaults requires `update` to have a rev hence the `.` return _helpmessage('hg commit', _updatecleanmsg()) def _bisectmsg():
64
64
62
6
58
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_bisectmsg
_bisectmsg
632
636
632
632
01baf83dd49e328953ae40d69cbc184a1b6fb965
bigcode/the-stack
train
18134472c089124aa3475b54
train
function
def _mergepredicate(repo): return len(repo[None].parents()) > 1
def _mergepredicate(repo):
return len(repo[None].parents()) > 1
good\n' 'To mark the changeset bad: hg bisect --bad\n' 'To abort: hg bisect --reset\n') return _commentlines(msg) def fileexistspredicate(filename): return lambda repo: repo.vfs.exists(filename) def _mergepredicate(repo):
64
64
19
6
58
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_mergepredicate
_mergepredicate
641
642
641
641
fbe65917aaad7dafe96e5b64aab594b913da3411
bigcode/the-stack
train
6a0bd66e5caee6fe0a803490
train
class
class jsonchangeset(changeset_printer): '''format changeset information.''' def __init__(self, ui, repo, matchfn, diffopts, buffered): changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered) self.cache = {} self._first = True def close(self): if not self._fi...
class jsonchangeset(changeset_printer):
'''format changeset information.''' def __init__(self, ui, repo, matchfn, diffopts, buffered): changeset_printer.__init__(self, ui, repo, matchfn, diffopts, buffered) self.cache = {} self._first = True def close(self): if not self._first: self.ui.write("\n]\n") ...
") else: # i18n: column positioning for "hg log" self.ui.write(_("summary: %s\n") % description.splitlines()[0], label='log.summary') self.ui.write("\n") self.showpatch(ctx, matchfn) def _ex...
256
256
1,037
10
246
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
jsonchangeset
jsonchangeset
1,765
1,862
1,765
1,765
fb3d23be1531df65df25c54ed2ced7a95e3e1228
bigcode/the-stack
train
b3c3aa182c5111c32b0ed414
train
function
def logmessage(ui, opts): """ get the log message according to -m and -l option """ message = opts.get('message') logfile = opts.get('logfile') if message and logfile: raise error.Abort(_('options --message and --logfile are mutually ' 'exclusive')) if not message...
def logmessage(ui, opts):
""" get the log message according to -m and -l option """ message = opts.get('message') logfile = opts.get('logfile') if message and logfile: raise error.Abort(_('options --message and --logfile are mutually ' 'exclusive')) if not message and logfile: try:...
4] if modified or added or removed or deleted: raise error.Abort(_('uncommitted changes'), hint=hint) ctx = repo[None] for s in sorted(ctx.substate): ctx.sub(s).bailifchanged(hint=hint) def logmessage(ui, opts):
64
64
145
7
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
logmessage
logmessage
762
779
762
762
0202431ad8b6cdee63f1ca95ba3d110ad400da70
bigcode/the-stack
train
5ecf064e86018de14f684fc3
train
class
class _unclosablefile(object): def __init__(self, fp): self._fp = fp def close(self): pass def __iter__(self): return iter(self._fp) def __getattr__(self, attr): return getattr(self._fp, attr) def __enter__(self): return self def __exit__(self, exc_ty...
class _unclosablefile(object):
def __init__(self, fp): self._fp = fp def close(self): pass def __iter__(self): return iter(self._fp) def __getattr__(self, attr): return getattr(self._fp, attr) def __enter__(self): return self def __exit__(self, exc_type, exc_value, exc_tb): ...
raise error.Abort(_("invalid format spec '%%%s' in output filename") % inst.args[0]) def isstdiofilename(pat): """True if the given pat looks like a filename denoting stdin/stdout""" return not pat or pat == '-' class _unclosablefile(object):
64
64
95
8
55
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_unclosablefile
_unclosablefile
893
910
893
893
73ed168f96405c2fcd8d69a75de5deecab248061
bigcode/the-stack
train
53ce4cf0a3fb9834cceb9693
train
function
def getlogrevs(repo, pats, opts): """Return (revs, expr, filematcher) where revs is an iterable of revision numbers, expr is a revset string built from log options and file patterns or None, and used to filter 'revs'. If --stat or --patch are not passed filematcher is None. Otherwise it is a callabl...
def getlogrevs(repo, pats, opts):
"""Return (revs, expr, filematcher) where revs is an iterable of revision numbers, expr is a revset string built from log options and file patterns or None, and used to filter 'revs'. If --stat or --patch are not passed filematcher is None. Otherwise it is a callable taking a revision number and ret...
revs) if limit is not None: limitedrevs = [] for idx, rev in enumerate(revs): if idx >= limit: break limitedrevs.append(rev) revs = smartset.baseset(limitedrevs) return revs, expr, filematcher def getlogrevs(repo, pats, opts):
78
78
261
11
66
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
getlogrevs
getlogrevs
2,570
2,594
2,570
2,570
556b646cc5c8c26a285a7b9c84215bd47f1031e6
bigcode/the-stack
train
2f4f4f5296d7a83c9bbf8acd
train
class
class changeset_templater(changeset_printer): '''format changeset information.''' # Arguments before "buffered" used to be positional. Consider not # adding/removing arguments before "buffered" to not break callers. def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None, bu...
class changeset_templater(changeset_printer):
'''format changeset information.''' # Arguments before "buffered" used to be positional. Consider not # adding/removing arguments before "buffered" to not break callers. def __init__(self, ui, repo, tmplspec, matchfn=None, diffopts=None, buffered=False): diffopts = diffopts or ...
", ".join('"%s": "%s"' % (j(k), j(v)) for k, v in copies)) matchfn = self.matchfn if matchfn: stat = self.diffopts.get('stat') diff = self.diffopts.get('patch') diffopts = patch.difffeatureopts(self.ui, self.di...
235
235
784
12
223
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
changeset_templater
changeset_templater
1,864
1,950
1,864
1,864
2eb2e3ee46eee6486f1f1c4077ed6ef6ecfb7b33
bigcode/the-stack
train
7d93395b83f3f2173cbeebe1
train
function
def getgraphlogrevs(repo, pats, opts): """Return (revs, expr, filematcher) where revs is an iterable of revision numbers, expr is a revset string built from log options and file patterns or None, and used to filter 'revs'. If --stat or --patch are not passed filematcher is None. Otherwise it is a ca...
def getgraphlogrevs(repo, pats, opts):
"""Return (revs, expr, filematcher) where revs is an iterable of revision numbers, expr is a revset string built from log options and file patterns or None, and used to filter 'revs'. If --stat or --patch are not passed filematcher is None. Otherwise it is a callable taking a revision number and ret...
if opts.get('rev'): revs = scmutil.revrange(repo, opts['rev']) elif follow and repo.dirstate.p1() == nullid: revs = smartset.baseset() elif follow: revs = repo.revs('reverse(:.)') else: revs = smartset.spanset(repo) revs.reverse() return revs def getgraphlogre...
98
98
327
12
85
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
getgraphlogrevs
getgraphlogrevs
2,539
2,568
2,539
2,539
dfe0df82ec7bff2072326de32dc7984d207c913f
bigcode/the-stack
train
28bbacfbf081836cb5113f22
train
function
def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, filterfn, *pats, **opts): from . import merge as mergemod opts = pycompat.byteskwargs(opts) if not ui.interactive(): if cmdsuggest: msg = _('running non-interactively, use %s instead') % cmdsuggest else: ...
def dorecord(ui, repo, commitfunc, cmdsuggest, backupall, filterfn, *pats, **opts):
from . import merge as mergemod opts = pycompat.byteskwargs(opts) if not ui.interactive(): if cmdsuggest: msg = _('running non-interactively, use %s instead') % cmdsuggest else: msg = _('running non-interactively') raise error.Abort(msg) # make sure usern...
: recordfn = crecordmod.testdecorator(testfile, crecordmod.testchunkselector) else: recordfn = crecordmod.chunkselector return crecordmod.filterpatch(ui, originalhunks, recordfn, operation) else: return patch.filterpat...
256
256
1,508
27
228
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
dorecord
dorecord
221
402
221
222
d4d4c61a130352c7e6a25aa21eb6228b3284001c
bigcode/the-stack
train
b8d56d8214f2ebaa44495fcd
train
function
def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None, editform='', unchangedmessagedetection=False): if not extramsg: extramsg = _("Leave message empty to abort commit.") forms = [e for e in editform.split('.') if e] forms.insert(0, 'changeset') templatete...
def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None, editform='', unchangedmessagedetection=False):
if not extramsg: extramsg = _("Leave message empty to abort commit.") forms = [e for e in editform.split('.') if e] forms.insert(0, 'changeset') templatetext = None while forms: ref = '.'.join(forms) if repo.ui.config('committemplate', ref): templatetext = commit...
nullid) mapping = {old.node(): (newid,)} if node: mapping[node] = () scmutil.cleanupnodes(repo, mapping, 'amend') return newid def commiteditor(repo, ctx, subs, editform=''): if ctx.description(): return ctx.description() return commitforceeditor...
121
121
405
30
91
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
commitforceeditor
commitforceeditor
3,188
3,236
3,188
3,189
6deba46ea5459e3f6568244189077c739ab69ace
bigcode/the-stack
train
520cbe5a8ad2325a8a9e5824
train
function
def postcommitstatus(repo, pats, opts): return repo.status(match=scmutil.match(repo[None], pats, opts))
def postcommitstatus(repo, pats, opts):
return repo.status(match=scmutil.match(repo[None], pats, opts))
.debugflag: repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex())) elif repo.ui.verbose: repo.ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx)) def postcommitstatus(repo, pats, opts):
64
64
27
10
54
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
postcommitstatus
postcommitstatus
3,331
3,332
3,331
3,331
08f061760b864791f83d9623cd74aab37ce90dad
bigcode/the-stack
train
6471697d70bcdc0e29dbdb6b
train
function
def morestatus(repo, fm): statetuple = _getrepostate(repo) label = 'status.morestatus' if statetuple: fm.startitem() state, statedetectionpredicate, helpfulmsg = statetuple statemsg = _('The repository is in an unfinished *%s* state.') % state fm.write('statemsg', '%s\n', _c...
def morestatus(repo, fm):
statetuple = _getrepostate(repo) label = 'status.morestatus' if statetuple: fm.startitem() state, statedetectionpredicate, helpfulmsg = statetuple statemsg = _('The repository is in an unfinished *%s* state.') % state fm.write('statemsg', '%s\n', _commentlines(statemsg), lab...
skip = set(repo.ui.configlist('commands', 'status.skipstates')) for state, statedetectionpredicate, msgfn in STATES: if state in skip: continue if statedetectionpredicate(repo): return (state, statedetectionpredicate, msgfn) def morestatus(repo, fm):
64
64
161
7
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
morestatus
morestatus
667
680
667
667
79cde8863db8e5951173467c922deca6e5e32474
bigcode/the-stack
train
6f0d60fb87d52628deaa2598
train
function
def _revertprefetch(repo, ctx, *files): """Let extension changing the storage layer prefetch content""" pass
def _revertprefetch(repo, ctx, *files):
"""Let extension changing the storage layer prefetch content""" pass
ctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) except KeyError: raise error.Abort("subrepository '%s' does not exist in %s!" % (sub, short(ctx.node()))) def _revertprefetch(repo, ctx, *files):
63
64
28
13
50
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_revertprefetch
_revertprefetch
3,617
3,619
3,617
3,617
0953daecc61d87d769edefc5cc791c6ed838fad5
bigcode/the-stack
train
c46a8db33118de8be141f02f
train
function
def diffordiffstat(ui, repo, diffopts, node1, node2, match, changes=None, stat=False, fp=None, prefix='', root='', listsubrepos=False): '''show diff or diffstat.''' if fp is None: write = ui.write else: def write(s, **kw): fp.write(s) if...
def diffordiffstat(ui, repo, diffopts, node1, node2, match, changes=None, stat=False, fp=None, prefix='', root='', listsubrepos=False):
'''show diff or diffstat.''' if fp is None: write = ui.write else: def write(s, **kw): fp.write(s) if root: relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) else: relroot = '' if relroot != '': # XXX relative roots currently don't ...
= makefileobj(repo, fntemplate, ctx.node(), desc=desc, total=total, seqno=seqno, revwidth=revwidth, mode='wb', modemap=filemode) dest = fo.name def write(s, **kw): fo.write(s) if not dest.startswith('<'): ...
157
157
524
41
116
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
diffordiffstat
diffordiffstat
1,513
1,568
1,513
1,515
2ae259745c5a7ea9944285dc2540d5678fb2bbe8
bigcode/the-stack
train
a73038c9bec2b161276361fd
train
function
def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts): node = scmutil.binnode(ctx) parents = [p.node() for p in ctx.parents() if p] branch = ctx.branch() if switch_parent: parents.reverse() if parents: prev = parents[0] else: prev = nullid ...
def _exportsingle(repo, ctx, match, switch_parent, rev, seqno, write, diffopts):
node = scmutil.binnode(ctx) parents = [p.node() for p in ctx.parents() if p] branch = ctx.branch() if switch_parent: parents.reverse() if parents: prev = parents[0] else: prev = nullid write("# HG changeset patch\n") write("# User %s\n" % ctx.user()) write("...
an exported patch # list of identifiers to be executed in order extraexport = [] # mapping from identifier to actual export function # function as to return a string to be added to the header or None # it is given two arguments (sequencenumber, changectx) extraexportmap = {} def _exportsingle(repo, ctx, match, switch_...
87
87
290
23
64
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_exportsingle
_exportsingle
1,421
1,452
1,421
1,421
82c28e929ef32e52745de967843777c7feb72db9
bigcode/the-stack
train
36a5472f03727a0f3c4e1be6
train
function
def buildcommittemplate(repo, ctx, subs, extramsg, ref): ui = repo.ui spec = formatter.templatespec(ref, None, None) t = changeset_templater(ui, repo, spec, None, {}, False) t.t.cache.update((k, templater.unquotestring(v)) for k, v in repo.ui.configitems('committemplate')) if n...
def buildcommittemplate(repo, ctx, subs, extramsg, ref):
ui = repo.ui spec = formatter.templatespec(ref, None, None) t = changeset_templater(ui, repo, spec, None, {}, False) t.t.cache.update((k, templater.unquotestring(v)) for k, v in repo.ui.configitems('committemplate')) if not extramsg: extramsg = '' # ensure that extramsg...
(text) if not text.strip(): raise error.Abort(_("empty commit message")) if unchangedmessagedetection and editortext == templatetext: raise error.Abort(_("commit message unchanged")) return text def buildcommittemplate(repo, ctx, subs, extramsg, ref):
64
64
128
16
47
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
buildcommittemplate
buildcommittemplate
3,238
3,250
3,238
3,238
b7a4fc1d9cf38376cc08ef7c5218ec14e876a94d
bigcode/the-stack
train
5336c767d5b644ff145cb3b9
train
function
def newandmodified(chunks, originalchunks): newlyaddedandmodifiedfiles = set() for chunk in chunks: if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \ originalchunks: newlyaddedandmodifiedfiles.add(chunk.header.filename()) return newlyaddedandmodifiedfiles
def newandmodified(chunks, originalchunks):
newlyaddedandmodifiedfiles = set() for chunk in chunks: if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \ originalchunks: newlyaddedandmodifiedfiles.add(chunk.header.filename()) return newlyaddedandmodifiedfiles
ored in the # editor text _linebelow = "^HG: ------------------------ >8 ------------------------$" def ishunk(x): hunkclasses = (crecordmod.uihunk, patch.recordhunk) return isinstance(x, hunkclasses) def newandmodified(chunks, originalchunks):
64
64
66
10
54
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
newandmodified
newandmodified
167
173
167
167
f8c4d6f5b1e06be5c034c8b213a2f770659155b3
bigcode/the-stack
train
8046453d094162bc71af8c7c
train
function
def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, filematcher=None): formatnode = _graphnodeformatter(ui, displayer) state = graphmod.asciistate() styles = state['styles'] # only set graph styling if HGPLAIN is not set. if ui.plain('graph'): # set all edge...
def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None, filematcher=None):
formatnode = _graphnodeformatter(ui, displayer) state = graphmod.asciistate() styles = state['styles'] # only set graph styling if HGPLAIN is not set. if ui.plain('graph'): # set all edge styles to |, the default pre-3.8 behaviour styles.update(dict.fromkeys(styles, '|')) else: ...
emplater(ui, spec) cache = {} if isinstance(displayer, changeset_templater): cache = displayer.cache # reuse cache of slow templates props = templatekw.keywords.copy() props['templ'] = templ props['cache'] = cache def formatnode(repo, ctx): props['ctx'] = ctx props['repo...
138
138
461
24
113
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
displaygraph
displaygraph
2,617
2,667
2,617
2,618
31e2e0dbcff88c96dfc330e912cf521e6e7284d1
bigcode/the-stack
train
d7ab3f709742b5b27332ab20
train
function
def _unshelvemsg(): return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
def _unshelvemsg():
return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
return _commentlines(msg) def _rebasemsg(): return _helpmessage('hg rebase --continue', 'hg rebase --abort') def _histeditmsg(): return _helpmessage('hg histedit --continue', 'hg histedit --abort') def _unshelvemsg():
64
64
28
7
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_unshelvemsg
_unshelvemsg
617
618
617
617
232bbfaa74bbd89d116f102948fa061cbefddf38
bigcode/the-stack
train
4aa226b9c1a1bee0399d5246
train
function
def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts): err = 1 def write(path): filename = None if fntemplate: filename = makefilename(repo, fntemplate, ctx.node(), pathname=os.path.join(prefix, path)) with formatter.maybereo...
def cat(ui, repo, ctx, matcher, basefm, fntemplate, prefix, **opts):
err = 1 def write(path): filename = None if fntemplate: filename = makefilename(repo, fntemplate, ctx.node(), pathname=os.path.join(prefix, path)) with formatter.maybereopen(basefm, filename, opts) as fm: data = ctx[path].data(...
') % m.rel(f)) ui.progress(_('deleting'), None) with repo.wlock(): if not after: for f in list: if f in added: continue # we never unlink added files on remove repo.wvfs.unlinkpath(f, ignoremissing=True) repo[None].forget(list) ...
112
112
374
22
89
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
cat
cat
2,947
2,992
2,947
2,947
3df5136c55d8412113aca779a6a41dcfb6ab925c
bigcode/the-stack
train
7e433f8489793f9458e255d8
train
function
def loglimit(opts): """get the log limit according to option -l/--limit""" limit = opts.get('limit') if limit: try: limit = int(limit) except ValueError: raise error.Abort(_('limit must be a positive integer')) if limit <= 0: raise error.Abort(_('l...
def loglimit(opts):
"""get the log limit according to option -l/--limit""" limit = opts.get('limit') if limit: try: limit = int(limit) except ValueError: raise error.Abort(_('limit must be a positive integer')) if limit <= 0: raise error.Abort(_('limit must be positiv...
desc=finishdesc, extramsg=extramsg, editform=editform) elif editform: return lambda r, c, s: commiteditor(r, c, s, editform=editform) else: return commiteditor def loglimit(opts):
64
64
89
5
58
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
loglimit
loglimit
829
841
829
829
933cea0fac4fb8af51103384a42104f3484c5976
bigcode/the-stack
train
4df5f7b43dc749c687985570
train
function
def _helpmessage(continuecmd, abortcmd): msg = _('To continue: %s\n' 'To abort: %s') % (continuecmd, abortcmd) return _commentlines(msg)
def _helpmessage(continuecmd, abortcmd):
msg = _('To continue: %s\n' 'To abort: %s') % (continuecmd, abortcmd) return _commentlines(msg)
unresolvedlist]) msg = _('''Unresolved merge conflicts: %s To mark files as resolved: hg resolve --mark FILE''') % mergeliststr else: msg = _('No unresolved merge conflicts.') return _commentlines(msg) def _helpmessage(continuecmd, abortcmd):
64
64
47
11
53
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_helpmessage
_helpmessage
606
609
606
606
263a54b8d3d4a9e61c94cf5321f178319a5698aa
bigcode/the-stack
train
42a56758ed668e2fa846cedc
train
function
def checkafterresolved(repo): '''Inform the user about the next action after completing hg resolve If there's a matching afterresolvedstates, howtocontinue will yield repo.ui.warn as the reporter. Otherwise, it will yield repo.ui.note. ''' msg, warning = howtocontinue(repo) if msg is not N...
def checkafterresolved(repo):
'''Inform the user about the next action after completing hg resolve If there's a matching afterresolvedstates, howtocontinue will yield repo.ui.warn as the reporter. Otherwise, it will yield repo.ui.note. ''' msg, warning = howtocontinue(repo) if msg is not None: if warning: ...
, msg in afterresolvedstates: if repo.vfs.exists(f): return contmsg % msg, True if repo[None].dirty(missing=True, merge=False, branch=False): return contmsg % _("hg commit"), False return None, None def checkafterresolved(repo):
64
64
103
6
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
checkafterresolved
checkafterresolved
3,838
3,851
3,838
3,838
0e47a6021e8f5814f3958e3a6406ee5d5405882e
bigcode/the-stack
train
561e1c0fdc85a4eeac1809d7
train
function
def _mergemsg(): # tweakdefaults requires `update` to have a rev hence the `.` return _helpmessage('hg commit', _updatecleanmsg())
def _mergemsg(): # tweakdefaults requires `update` to have a rev hence the `.`
return _helpmessage('hg commit', _updatecleanmsg())
or '.', warning) def _graftmsg(): # tweakdefaults requires `update` to have a rev hence the `.` return _helpmessage('hg graft --continue', _updatecleanmsg()) def _mergemsg(): # tweakdefaults requires `update` to have a rev hence the `.`
64
64
36
22
42
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_mergemsg
_mergemsg
628
630
628
629
c081606e0e66c07113de298c64116c4e2d268c07
bigcode/the-stack
train
5914630e3c525061f61f501d
train
function
def _conflictsmsg(repo): # avoid merge cycle from . import merge as mergemod mergestate = mergemod.mergestate.read(repo) if not mergestate.active(): return m = scmutil.match(repo[None]) unresolvedlist = [f for f in mergestate if m(f) and mergestate[f] == 'u'] if unresolvedlist: ...
def _conflictsmsg(repo): # avoid merge cycle
from . import merge as mergemod mergestate = mergemod.mergestate.read(repo) if not mergestate.active(): return m = scmutil.match(repo[None]) unresolvedlist = [f for f in mergestate if m(f) and mergestate[f] == 'u'] if unresolvedlist: mergeliststr = '\n'.join( [' %...
'''Surround lineswith a comment char and a new line''' lines = raw.splitlines() commentedlines = ['# %s' % line for line in lines] return '\n'.join(commentedlines) + '\n' def _conflictsmsg(repo): # avoid merge cycle
64
64
177
13
51
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_conflictsmsg
_conflictsmsg
582
604
582
583
aa4e441c9111263e47f94c2929b942ccd4af3128
bigcode/the-stack
train
c47d24046f461515d26dd2f2
train
function
def walkchangerevs(repo, match, opts, prepare): '''Iterate over files and the revs in which they changed. Callers most commonly need to iterate backwards over the history in which they are interested. Doing so has awful (quadratic-looking) performance, so we use iterators in a "windowed" way. We w...
def walkchangerevs(repo, match, opts, prepare):
'''Iterate over files and the revs in which they changed. Callers most commonly need to iterate backwards over the history in which they are interested. Doing so has awful (quadratic-looking) performance, so we use iterators in a "windowed" way. We walk a window of revisions in the desired order. ...
init__(self, repo, onlyfirst=False): self.repo = repo self.startrev = nullrev self.roots = set() self.onlyfirst = onlyfirst def match(self, rev): def realparents(rev): if self.onlyfirst: return self.repo.changelog.parentrevs(rev)[0:1] ...
256
256
1,063
13
242
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
walkchangerevs
walkchangerevs
2,202
2,338
2,202
2,202
b42968167e834c5666cd46114956a75b7dd9c580
bigcode/the-stack
train
e7c7e24884efa292a9675bbf
train
function
def buildcommittext(repo, ctx, subs, extramsg): edittext = [] modified, added, removed = ctx.modified(), ctx.added(), ctx.removed() if ctx.description(): edittext.append(ctx.description()) edittext.append("") edittext.append("") # Empty line between message and comments. edittext.append(...
def buildcommittext(repo, ctx, subs, extramsg):
edittext = [] modified, added, removed = ctx.modified(), ctx.added(), ctx.removed() if ctx.description(): edittext.append(ctx.description()) edittext.append("") edittext.append("") # Empty line between message and comments. edittext.append(hgprefix(_("Enter commit message." ...
items('committemplate')) if not extramsg: extramsg = '' # ensure that extramsg is string ui.pushbuffer() t.show(ctx, extramsg=extramsg) return ui.popbuffer() def hgprefix(msg): return "\n".join(["HG: %s" % a for a in msg.split("\n") if a]) def buildcommittext(repo, ctx, subs, extramsg):
95
95
317
14
81
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
buildcommittext
buildcommittext
3,255
3,281
3,255
3,255
59f2f7ba35b24fee9e566d452dbfdc12e9a99bf8
bigcode/the-stack
train
b459beca0d8e52b941073c00
train
function
def getcommiteditor(edit=False, finishdesc=None, extramsg=None, editform='', **opts): """get appropriate commit message editor according to '--edit' option 'finishdesc' is a function to be called with edited commit message (= 'description' of the new changeset) just after editing, but ...
def getcommiteditor(edit=False, finishdesc=None, extramsg=None, editform='', **opts):
"""get appropriate commit message editor according to '--edit' option 'finishdesc' is a function to be called with edited commit message (= 'description' of the new changeset) just after editing, but before checking empty-ness. It should return actual text to be stored into history. This allows to ...
if it is a merge, otherwise '.normal' is appended. """ if isinstance(ctxorbool, bool): if ctxorbool: return baseformname + ".merge" elif 1 < len(ctxorbool.parents()): return baseformname + ".merge" return baseformname + ".normal" def getcommiteditor(edit=False, finishde...
93
93
310
24
69
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
getcommiteditor
getcommiteditor
798
827
798
799
2826659179adc2fd1fc5d8176294c441b9f1a4ee
bigcode/the-stack
train
56158728a0e9e8a6fcc65c32
train
function
def makelogtemplater(ui, repo, tmpl, buffered=False): """Create a changeset_templater from a literal template 'tmpl'""" spec = logtemplatespec(tmpl, None) return changeset_templater(ui, repo, spec, buffered=buffered)
def makelogtemplater(ui, repo, tmpl, buffered=False):
"""Create a changeset_templater from a literal template 'tmpl'""" spec = logtemplatespec(tmpl, None) return changeset_templater(ui, repo, spec, buffered=buffered)
if mapname: mapfile = mapname return logtemplatespec(None, mapfile) if not tmpl: return logtemplatespec(None, None) return formatter.lookuptemplate(ui, 'changeset', tmpl) def makelogtemplater(ui, repo, tmpl, buffered=False):
64
64
60
14
50
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
makelogtemplater
makelogtemplater
1,986
1,989
1,986
1,986
eaafeeae7ae256632dc5f68057a1b15719fb10e5
bigcode/the-stack
train
34928a6bef6b78bcd818b4e0
train
function
def makefileobj(repo, pat, node=None, desc=None, total=None, seqno=None, revwidth=None, mode='wb', modemap=None, pathname=None): writable = mode not in ('r', 'rb') if isstdiofilename(pat): if writable: fp = repo.ui.fout else: fp = repo.ui...
def makefileobj(repo, pat, node=None, desc=None, total=None, seqno=None, revwidth=None, mode='wb', modemap=None, pathname=None):
writable = mode not in ('r', 'rb') if isstdiofilename(pat): if writable: fp = repo.ui.fout else: fp = repo.ui.fin return _unclosablefile(fp) fn = makefilename(repo, pat, node, desc, total, seqno, revwidth, pathname) if modemap is not None: mode = ...
__(self): return self def __exit__(self, exc_type, exc_value, exc_tb): pass def makefileobj(repo, pat, node=None, desc=None, total=None, seqno=None, revwidth=None, mode='wb', modemap=None, pathname=None):
64
64
154
38
25
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
makefileobj
makefileobj
912
929
912
915
d569bdd623fd933c7d93d828bd3d0495aa3ab668
bigcode/the-stack
train
c25ab7059d1e2ee6aa2f4a49
train
function
def _updatecleanmsg(dest=None): warning = _('warning: this will discard uncommitted changes') return 'hg update --clean %s (%s)' % (dest or '.', warning)
def _updatecleanmsg(dest=None):
warning = _('warning: this will discard uncommitted changes') return 'hg update --clean %s (%s)' % (dest or '.', warning)
--abort') def _histeditmsg(): return _helpmessage('hg histedit --continue', 'hg histedit --abort') def _unshelvemsg(): return _helpmessage('hg unshelve --continue', 'hg unshelve --abort') def _updatecleanmsg(dest=None):
64
64
42
8
56
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_updatecleanmsg
_updatecleanmsg
620
622
620
620
03036ec949740ddb57ba9b1ab53b850dc3a20e46
bigcode/the-stack
train
87c8fbacb46f2848f32873d0
train
function
def _lookuplogtemplate(ui, tmpl, style): """Find the template matching the given template spec or style See formatter.lookuptemplate() for details. """ # ui settings if not tmpl and not style: # template are stronger than style tmpl = ui.config('ui', 'logtemplate') if tmpl: ...
def _lookuplogtemplate(ui, tmpl, style):
"""Find the template matching the given template spec or style See formatter.lookuptemplate() for details. """ # ui settings if not tmpl and not style: # template are stronger than style tmpl = ui.config('ui', 'logtemplate') if tmpl: return logtemplatespec(templater.unq...
.t(self._parts['footer'], **props)) def logtemplatespec(tmpl, mapfile): if mapfile: return formatter.templatespec('changeset', tmpl, mapfile) else: return formatter.templatespec('', tmpl, None) def _lookuplogtemplate(ui, tmpl, style):
64
64
208
12
52
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_lookuplogtemplate
_lookuplogtemplate
1,958
1,984
1,958
1,958
2bd98b118c5049af4faecf82f22471cba27f162e
bigcode/the-stack
train
9fb275d6fdae5e576a87890c
train
function
def isstdiofilename(pat): """True if the given pat looks like a filename denoting stdin/stdout""" return not pat or pat == '-'
def isstdiofilename(pat):
"""True if the given pat looks like a filename denoting stdin/stdout""" return not pat or pat == '-'
c = expander[c]() newname.append(c) i += 1 return ''.join(newname) except KeyError as inst: raise error.Abort(_("invalid format spec '%%%s' in output filename") % inst.args[0]) def isstdiofilename(pat):
64
64
33
7
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
isstdiofilename
isstdiofilename
889
891
889
889
badccd6269a9b2df6339395e89c158ad956dc903
bigcode/the-stack
train
b5d3b940688b668e65e70d1c
train
function
def filterchunks(ui, originalhunks, usecurses, testfile, operation=None): if usecurses: if testfile: recordfn = crecordmod.testdecorator(testfile, crecordmod.testchunkselector) else: recordfn = crecordmod.chunkselector ...
def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
if usecurses: if testfile: recordfn = crecordmod.testdecorator(testfile, crecordmod.testchunkselector) else: recordfn = crecordmod.chunkselector return crecordmod.filterpatch(ui, originalhunks, recordfn, operation) ...
l) oldwrite = ui.write def wrap(*args, **kwargs): return wrapwrite(oldwrite, *args, **kwargs) setattr(ui, 'write', wrap) return oldwrite def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
64
64
98
19
44
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
filterchunks
filterchunks
191
202
191
191
4feddf1339ce7dea5b91a8bb257d14daf2943a2d
bigcode/the-stack
train
624903376e48d1cdd6fece45
train
function
def findpossible(cmd, table, strict=False): """ Return cmd -> (aliases, command table entry) for each matching command. Return debug commands (or their aliases) only if no normal command matches. """ choice = {} debugchoice = {} if cmd in table: # short-circuit exact matches, "l...
def findpossible(cmd, table, strict=False):
""" Return cmd -> (aliases, command table entry) for each matching command. Return debug commands (or their aliases) only if no normal command matches. """ choice = {} debugchoice = {} if cmd in table: # short-circuit exact matches, "log" alias beats "^log|history" keys ...
= _conflictsmsg(repo) if conmsg: fm.write('conflictsmsg', '%s\n', conmsg, label=label) if helpfulmsg: helpmsg = helpfulmsg() fm.write('helpmsg', '%s\n', helpmsg, label=label) def findpossible(cmd, table, strict=False):
71
71
237
10
61
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
findpossible
findpossible
682
718
682
682
997f1080867fb9f6106826f2d67fe99c95283119
bigcode/the-stack
train
2d2418699a9366db1d3e46d0
train
function
def wrongtooltocontinue(repo, task): '''Raise an abort suggesting how to properly continue if there is an active task. Uses howtocontinue() to find the active task. If there's no task (repo.ui.note for 'hg commit'), it does not offer a hint. ''' after = howtocontinue(repo) hint = None ...
def wrongtooltocontinue(repo, task):
'''Raise an abort suggesting how to properly continue if there is an active task. Uses howtocontinue() to find the active task. If there's no task (repo.ui.note for 'hg commit'), it does not offer a hint. ''' after = howtocontinue(repo) hint = None if after[1]: hint = after...
yield repo.ui.note. ''' msg, warning = howtocontinue(repo) if msg is not None: if warning: repo.ui.warn("%s\n" % msg) else: repo.ui.note("%s\n" % msg) def wrongtooltocontinue(repo, task):
64
64
113
10
54
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
wrongtooltocontinue
wrongtooltocontinue
3,853
3,866
3,853
3,853
fc0daa31056aa9dfad119438bd7d94b76846b73e
bigcode/the-stack
train
4e6e01fb5d8d7c9ce5b13345
train
function
def clearunfinished(repo): '''Check for unfinished operations (as above), and clear the ones that are clearable. ''' for f, clearable, allowcommit, msg, hint in unfinishedstates: if not clearable and repo.vfs.exists(f): raise error.Abort(msg, hint=hint) for f, clearable, allowcom...
def clearunfinished(repo):
'''Check for unfinished operations (as above), and clear the ones that are clearable. ''' for f, clearable, allowcommit, msg, hint in unfinishedstates: if not clearable and repo.vfs.exists(f): raise error.Abort(msg, hint=hint) for f, clearable, allowcommit, msg, hint in unfinishe...
to check this right before bailifchanged(). ''' for f, clearable, allowcommit, msg, hint in unfinishedstates: if commit and allowcommit: continue if repo.vfs.exists(f): raise error.Abort(msg, hint=hint) def clearunfinished(repo):
64
64
105
5
59
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
clearunfinished
clearunfinished
3,804
3,813
3,804
3,804
a11b43da3e62f8b822936b56139b053b838b86f9
bigcode/the-stack
train
1fe7f4d94ac3d10f69666c7f
train
function
def mergeeditform(ctxorbool, baseformname): """return appropriate editform name (referencing a committemplate) 'ctxorbool' is either a ctx to be committed, or a bool indicating whether merging is committed. This returns baseformname with '.merge' appended if it is a merge, otherwise '.normal' is a...
def mergeeditform(ctxorbool, baseformname):
"""return appropriate editform name (referencing a committemplate) 'ctxorbool' is either a ctx to be committed, or a bool indicating whether merging is committed. This returns baseformname with '.merge' appended if it is a merge, otherwise '.normal' is appended. """ if isinstance(ctxorbool...
message = '\n'.join(util.readfile(logfile).splitlines()) except IOError as inst: raise error.Abort(_("can't read commit message '%s': %s") % (logfile, inst.strerror)) return message def mergeeditform(ctxorbool, baseformname):
64
64
131
12
51
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
mergeeditform
mergeeditform
781
796
781
781
24643167f5a05eb132aff4081ae4725849cb32ae
bigcode/the-stack
train
6c30b28035a908d12c8b064b
train
class
class FileWalkError(Exception): pass
class FileWalkError(Exception):
pass
'%d' % rev raise error.Abort(_("revision matching date not found")) def increasingwindows(windowsize=8, sizelimit=512): while True: yield windowsize if windowsize < sizelimit: windowsize *= 2 class FileWalkError(Exception):
64
64
9
6
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
FileWalkError
FileWalkError
2,065
2,066
2,065
2,065
fb104c2c31801be11102ee8417741abef82b6485
bigcode/the-stack
train
15bc8c2b5b25ee439fcce7c5
train
function
def finddate(ui, repo, date): """Find the tipmost changeset that matches the given date spec""" df = util.matchdate(date) m = scmutil.matchall(repo) results = {} def prep(ctx, fns): d = ctx.date() if df(d[0]): results[ctx.rev()] = d for ctx in walkchangerevs(repo, ...
def finddate(ui, repo, date):
"""Find the tipmost changeset that matches the given date spec""" df = util.matchdate(date) m = scmutil.matchall(repo) results = {} def prep(ctx, fns): d = ctx.date() if df(d[0]): results[ctx.rev()] = d for ctx in walkchangerevs(repo, m, {'rev': None}, prep): ...
', fm.formatdate(marker.date())) meta = marker.metadata().copy() meta.pop('date', None) fm.write('metadata', '{%s}', fm.formatdict(meta, fmt='%r: %r', sep=', ')) fm.plain('\n') def finddate(ui, repo, date):
64
64
152
9
55
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
finddate
finddate
2,038
2,057
2,038
2,038
5374da2d1caee0ad4d2fdd5a99620a21309278da
bigcode/the-stack
train
5265eb4ad9770d8e05062bde
train
function
def recordfilter(ui, originalhunks, operation=None): """ Prompts the user to filter the originalhunks and return a list of selected hunks. *operation* is used for to build ui messages to indicate the user what kind of filtering they are doing: reverting, committing, shelving, etc. (see patch.filterp...
def recordfilter(ui, originalhunks, operation=None):
""" Prompts the user to filter the originalhunks and return a list of selected hunks. *operation* is used for to build ui messages to indicate the user what kind of filtering they are doing: reverting, committing, shelving, etc. (see patch.filterpatch). """ usecurses = crecordmod.checkcurses...
mod.testchunkselector) else: recordfn = crecordmod.chunkselector return crecordmod.filterpatch(ui, originalhunks, recordfn, operation) else: return patch.filterpatch(ui, originalhunks, operation) def recordfilter(ui, originalhunks, operation=None):
64
64
160
12
52
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
recordfilter
recordfilter
204
219
204
204
229d5f10c4a9277da3f98a7816fd4ba12dfcf252
bigcode/the-stack
train
43df5bbe4e2f99a9d8db456a
train
function
def graphrevs(repo, nodes, opts): limit = loglimit(opts) nodes.reverse() if limit is not None: nodes = nodes[:limit] return graphmod.nodes(repo, nodes)
def graphrevs(repo, nodes, opts):
limit = loglimit(opts) nodes.reverse() if limit is not None: nodes = nodes[:limit] return graphmod.nodes(repo, nodes)
unsupportedgraphflags(pats, opts): for op in ["newest_first"]: if op in opts and opts[op]: raise error.Abort(_("-G/--graph option is incompatible with --%s") % op.replace("_", "-")) def graphrevs(repo, nodes, opts):
64
64
44
10
54
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
graphrevs
graphrevs
2,692
2,697
2,692
2,692
8e1846977d80a16ba0dce7f1e7104b11caf24d23
bigcode/the-stack
train
46861cdd5446296665ced5c2
train
function
def _makenofollowlogfilematcher(repo, pats, opts): '''hook for extensions to override the filematcher for non-follow cases''' return None
def _makenofollowlogfilematcher(repo, pats, opts):
'''hook for extensions to override the filematcher for non-follow cases''' return None
if not fcacheready[0]: # Lazy initialization fcacheready[0] = True populate() return scmutil.matchfiles(repo, fcache.get(rev, [])) return filematcher def _makenofollowlogfilematcher(repo, pats, opts):
64
64
33
14
49
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_makenofollowlogfilematcher
_makenofollowlogfilematcher
2,368
2,370
2,368
2,368
8481aa79770f63f5a6755d17453d1d8f5e797972
bigcode/the-stack
train
d5dc336dd3130d0b33ae0e6b
train
function
def checkunfinished(repo, commit=False): '''Look for an unfinished multistep operation, like graft, and abort if found. It's probably good to check this right before bailifchanged(). ''' for f, clearable, allowcommit, msg, hint in unfinishedstates: if commit and allowcommit: cont...
def checkunfinished(repo, commit=False):
'''Look for an unfinished multistep operation, like graft, and abort if found. It's probably good to check this right before bailifchanged(). ''' for f, clearable, allowcommit, msg, hint in unfinishedstates: if commit and allowcommit: continue if repo.vfs.exists(f): ...
False, _('graft in progress'), _("use 'hg graft --continue' or 'hg update' to abort")), ('updatestate', True, False, _('last update was interrupted'), _("use 'hg update' to get a consistent checkout")) ] def checkunfinished(repo, commit=False):
64
64
91
8
56
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
checkunfinished
checkunfinished
3,793
3,802
3,793
3,793
9711444f5f517f020ec7df99f43c99708abb9d09
bigcode/the-stack
train
a8a0e952a97805a084b77b6a
train
function
def graphlog(ui, repo, pats, opts): # Parameters are identical to log command ones revs, expr, filematcher = getgraphlogrevs(repo, pats, opts) revdag = graphmod.dagwalker(repo, revs) getrenamed = None if opts.get('copies'): endrev = None if opts.get('rev'): endrev = scmu...
def graphlog(ui, repo, pats, opts): # Parameters are identical to log command ones
revs, expr, filematcher = getgraphlogrevs(repo, pats, opts) revdag = graphmod.dagwalker(repo, revs) getrenamed = None if opts.get('copies'): endrev = None if opts.get('rev'): endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 getrenamed = templatekw.getrename...
, char, width, coldata in itertools.chain([firstedge], edges): graphmod.ascii(ui, state, type, char, lines, coldata) lines = [] displayer.close() def graphlog(ui, repo, pats, opts): # Parameters are identical to log command ones
64
64
171
21
43
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
graphlog
graphlog
2,669
2,684
2,669
2,670
f560ab819258323e4f4ecee923773b5bec6e4c2a
bigcode/the-stack
train
34dacf4a630a6941e0f21104
train
function
def commiteditor(repo, ctx, subs, editform=''): if ctx.description(): return ctx.description() return commitforceeditor(repo, ctx, subs, editform=editform, unchangedmessagedetection=True)
def commiteditor(repo, ctx, subs, editform=''):
if ctx.description(): return ctx.description() return commitforceeditor(repo, ctx, subs, editform=editform, unchangedmessagedetection=True)
repo.setparents(newid, nullid) mapping = {old.node(): (newid,)} if node: mapping[node] = () scmutil.cleanupnodes(repo, mapping, 'amend') return newid def commiteditor(repo, ctx, subs, editform=''):
64
64
49
14
49
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
commiteditor
commiteditor
3,182
3,186
3,182
3,182
5071f9a7360d14d88396b5ccdbe27aa51ee598e8
bigcode/the-stack
train
3951b81a6d7454beaaba5210
train
function
def show_changeset(ui, repo, opts, buffered=False): """show one changeset using template or regular display. Display format will be the first non-empty hit of: 1. option 'template' 2. option 'style' 3. [ui] setting 'logtemplate' 4. [ui] setting 'style' If all of these values are either the ...
def show_changeset(ui, repo, opts, buffered=False):
"""show one changeset using template or regular display. Display format will be the first non-empty hit of: 1. option 'template' 2. option 'style' 3. [ui] setting 'logtemplate' 4. [ui] setting 'style' If all of these values are either the unset or the empty string, regular display via c...
elogtemplater(ui, repo, tmpl, buffered=False): """Create a changeset_templater from a literal template 'tmpl'""" spec = logtemplatespec(tmpl, None) return changeset_templater(ui, repo, spec, buffered=buffered) def show_changeset(ui, repo, opts, buffered=False):
71
71
238
13
58
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
show_changeset
show_changeset
1,991
2,015
1,991
1,991
8307ff416b5dd259b31044f71aa20b8720009be3
bigcode/the-stack
train
5cf5833d6e147236d112470a
train
function
def _performrevert(repo, parents, ctx, actions, interactive=False, tobackup=None): """function that actually perform all the actions computed for revert This is an independent function to let extension to plug in and react to the imminent revert. Make sure you have the working direc...
def _performrevert(repo, parents, ctx, actions, interactive=False, tobackup=None):
"""function that actually perform all the actions computed for revert This is an independent function to let extension to plug in and react to the imminent revert. Make sure you have the working directory locked when calling this function. """ parent, p2 = parents node = ctx.node() exc...
util.copyfile(target, bakname) else: util.rename(target, bakname) if ui.verbose or not exact: if not isinstance(msg, str): msg = msg(abs) ui.status(msg % r...
256
256
1,071
21
234
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_performrevert
_performrevert
3,621
3,757
3,621
3,622
dc12d1b6b60b6714b458cca8da4303107242afad
bigcode/the-stack
train
b5f190f932032247a4e1bf13
train
function
def hgprefix(msg): return "\n".join(["HG: %s" % a for a in msg.split("\n") if a])
def hgprefix(msg):
return "\n".join(["HG: %s" % a for a in msg.split("\n") if a])
for k, v in repo.ui.configitems('committemplate')) if not extramsg: extramsg = '' # ensure that extramsg is string ui.pushbuffer() t.show(ctx, extramsg=extramsg) return ui.popbuffer() def hgprefix(msg):
64
64
30
5
59
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
hgprefix
hgprefix
3,252
3,253
3,252
3,252
8c58b6c63b5d697e6934165b4455a6eb7350d364
bigcode/the-stack
train
b41b7945547ee7f3942b5cc3
train
function
def samefile(f, ctx1, ctx2): if f in ctx1.manifest(): a = ctx1.filectx(f) if f in ctx2.manifest(): b = ctx2.filectx(f) return (not a.cmp(b) and a.flags() == b.flags()) else: return False else: return f not in ctx2.manifest()...
def samefile(f, ctx1, ctx2):
if f in ctx1.manifest(): a = ctx1.filectx(f) if f in ctx2.manifest(): b = ctx2.filectx(f) return (not a.cmp(b) and a.flags() == b.flags()) else: return False else: return f not in ctx2.manifest()
: if scmutil.addremove(repo, matcher, "", opts) != 0: raise error.Abort( _("failed to mark all new/missing files as added/removed")) return commitfunc(ui, repo, message, matcher, opts) def samefile(f, ctx1, ctx2):
64
64
85
11
53
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
samefile
samefile
3,015
3,025
3,015
3,015
148c091069ddcf557a244d4e311eb3b440abcda7
bigcode/the-stack
train
0f25859bacbec816af50fc2f
train
function
def ishunk(x): hunkclasses = (crecordmod.uihunk, patch.recordhunk) return isinstance(x, hunkclasses)
def ishunk(x):
hunkclasses = (crecordmod.uihunk, patch.recordhunk) return isinstance(x, hunkclasses)
('m', 'manifest', False, _('open manifest')), ('', 'dir', '', _('open directory manifest')), ] # special string such that everything below this line will be ingored in the # editor text _linebelow = "^HG: ------------------------ >8 ------------------------$" def ishunk(x):
64
64
32
5
59
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
ishunk
ishunk
163
165
163
163
e4689c26ccc37ee8b0d469ca8fb20ee6c38fb314
bigcode/the-stack
train
0fa9f48494de706f788c3942
train
function
def commit(ui, repo, commitfunc, pats, opts): '''commit the specified files or all outstanding changes''' date = opts.get('date') if date: opts['date'] = util.parsedate(date) message = logmessage(ui, opts) matcher = scmutil.match(repo[None], pats, opts) dsguard = None # extract addr...
def commit(ui, repo, commitfunc, pats, opts):
'''commit the specified files or all outstanding changes''' date = opts.get('date') if date: opts['date'] = util.parsedate(date) message = logmessage(ui, opts) matcher = scmutil.match(repo[None], pats, opts) dsguard = None # extract addremove carefully -- this function can be called...
(prefix, sub._path), **opts): err = 0 except error.RepoLookupError: ui.status(_("skipping missing subrepository: %s\n") % os.path.join(prefix, subpath)) return err def commit(ui, repo, commitfunc, pats, opts):
64
64
203
13
50
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
commit
commit
2,994
3,013
2,994
2,994
4afd47cc2845c46106891e4ecf738f7b3a17040e
bigcode/the-stack
train
334aac9c04917bef8769a3c1
train
function
def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None): join = lambda f: os.path.join(prefix, f) ret = 0 s = repo.status(match=m, clean=True) modified, added, deleted, clean = s[0], s[1], s[3], s[6] wctx = repo[None] if warnings is None: warnings = [] warn = Tru...
def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None):
join = lambda f: os.path.join(prefix, f) ret = 0 s = repo.status(match=m, clean=True) modified, added, deleted, clean = s[0], s[1], s[3], s[6] wctx = repo[None] if warnings is None: warnings = [] warn = True else: warn = False subs = sorted(wctx.substate) t...
repos): rev = ctx.rev() ret = 1 ds = ctx.repo().dirstate for f in ctx.matches(m): if rev is None and ds[f] == 'r': continue fm.startitem() if ui.verbose: fc = ctx[f] fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) fm.data(...
256
256
946
20
235
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
remove
remove
2,829
2,945
2,829
2,829
cc35554b6ef59f9a26403f6b9d1c3735b6bf0096
bigcode/the-stack
train
ee318a57534555e434ddc582
train
function
def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False, opts=None, match=None): '''export changesets as hg patches Args: repo: The repository from which we're exporting revisions. revs: A list of revisions to export as revision numbers. fntemplate: An optiona...
def export(repo, revs, fntemplate='hg-%h.patch', fp=None, switch_parent=False, opts=None, match=None):
'''export changesets as hg patches Args: repo: The repository from which we're exporting revisions. revs: A list of revisions to export as revision numbers. fntemplate: An optional string to use for generating patch file names. fp: An optional file-like object to which patches should be...
write("# Parent %s\n" % hex(prev)) if len(parents) > 1: write("# Parent %s\n" % hex(parents[1])) for headerid in extraexport: header = extraexportmap[headerid](seqno, ctx) if header is not None: write('# %s\n' % header) write(ctx.description().rstrip()) write("...
152
152
509
30
122
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
export
export
1,454
1,511
1,454
1,455
aa6945e58063b37d3b9addbd081a9da3bcbfc35a
bigcode/the-stack
train
28d21bdfa607f960fc0a6654
train
function
def _changesetlabels(ctx): labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()] if ctx.obsolete(): labels.append('changeset.obsolete') if ctx.isunstable(): labels.append('changeset.unstable') for instability in ctx.instabilities(): labels.append('instability.%s' % ...
def _changesetlabels(ctx):
labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()] if ctx.obsolete(): labels.append('changeset.obsolete') if ctx.isunstable(): labels.append('changeset.unstable') for instability in ctx.instabilities(): labels.append('instability.%s' % instability) return ' '...
ignore it. tempnode2 = None submatch = matchmod.subdirmatcher(subpath, match) sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, stat=stat, fp=fp, prefix=prefix) def _changesetlabels(ctx):
64
64
86
7
57
EnjoyLifeFund/py36pkgs
mercurial/cmdutil.py
Python
_changesetlabels
_changesetlabels
1,570
1,578
1,570
1,570
1b03d709ae0479d284c3c3a18f56a7628e6dc87b
bigcode/the-stack
train