Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 674:6513ba7d858a
Make consistent use of str.startswith() in conditionals.
# HG changeset patch
# User chad.netzer@gmail.com
# Node ID 45db196de89a15fd045cd789f701b0180fd276f1
# Parent fafc16f705b6cb413897577b67918af55e1baafe
Make consistent use of str.startswith() in conditionals.
author | chad.netzer@gmail.com |
---|---|
date | Sun, 10 Jul 2005 16:14:56 -0800 |
parents | d93f0b127b6a |
children | 49de76abc4da |
comparison
equal
deleted
inserted
replaced
673:8e518e11f6cf | 674:6513ba7d858a |
---|---|
604 ui.debug('text:\n') | 604 ui.debug('text:\n') |
605 for t in text.splitlines(): | 605 for t in text.splitlines(): |
606 ui.debug(t,'\n') | 606 ui.debug(t,'\n') |
607 if t == '# HG changeset patch' or hgpatch == True: | 607 if t == '# HG changeset patch' or hgpatch == True: |
608 hgpatch = True | 608 hgpatch = True |
609 if t[:7] == "# User ": | 609 if t.startswith("# User "): |
610 user = t[7:] | 610 user = t[7:] |
611 ui.debug('User: %s\n' % user) | 611 ui.debug('User: %s\n' % user) |
612 if t[:2] <> "# " and t.strip() and not snippet: snippet = t | 612 if not t.startswith("# ") and t.strip() and not snippet: snippet = t |
613 if snippet: text = snippet + '\n' + text | 613 if snippet: text = snippet + '\n' + text |
614 ui.debug('text:\n%s\n' % text) | 614 ui.debug('text:\n%s\n' % text) |
615 | 615 |
616 # make sure text isn't empty | 616 # make sure text isn't empty |
617 if not text: text = "imported patch %s\n" % patch | 617 if not text: text = "imported patch %s\n" % patch |
619 f = os.popen("patch -p%d < %s" % (strip, pf)) | 619 f = os.popen("patch -p%d < %s" % (strip, pf)) |
620 files = [] | 620 files = [] |
621 for l in f.read().splitlines(): | 621 for l in f.read().splitlines(): |
622 l.rstrip('\r\n'); | 622 l.rstrip('\r\n'); |
623 ui.status("%s\n" % l) | 623 ui.status("%s\n" % l) |
624 if l[:14] == 'patching file ': | 624 if l.startswith('patching file '): |
625 pf = l[14:] | 625 pf = l[14:] |
626 if pf not in files: | 626 if pf not in files: |
627 files.append(pf) | 627 files.append(pf) |
628 patcherr = f.close() | 628 patcherr = f.close() |
629 if patcherr: | 629 if patcherr: |