comparison mercurial/localrepo.py @ 8498:a5182c39766a

commit: simplify manifest commit
author Matt Mackall <mpm@selenic.com>
date Mon, 18 May 2009 17:36:24 -0500
parents a21605de1509
children fb9b83df45f3
comparison
equal deleted inserted replaced
8497:ff22d4c3ac04 8498:a5182c39766a
841 If editor is supplied, it is called to get a commit message. 841 If editor is supplied, it is called to get a commit message.
842 If working is set, the working directory is affected. 842 If working is set, the working directory is affected.
843 """ 843 """
844 844
845 tr = lock = None 845 tr = lock = None
846 remove = ctx.removed() 846 removed = ctx.removed()
847 p1, p2 = ctx.p1(), ctx.p2() 847 p1, p2 = ctx.p1(), ctx.p2()
848 m1 = p1.manifest().copy() 848 m1 = p1.manifest().copy()
849 m2 = p2.manifest() 849 m2 = p2.manifest()
850 user = ctx.user() 850 user = ctx.user()
851 851
871 except (OSError, IOError): 871 except (OSError, IOError):
872 if error: 872 if error:
873 self.ui.warn(_("trouble committing %s!\n") % f) 873 self.ui.warn(_("trouble committing %s!\n") % f)
874 raise 874 raise
875 else: 875 else:
876 remove.append(f) 876 removed.append(f)
877 877
878 # update manifest 878 # update manifest
879 m1.update(new) 879 m1.update(new)
880 removed = [f for f in sorted(remove) if f in m1 or f in m2] 880 removed = [f for f in sorted(removed) if f in m1 or f in m2]
881 removed1 = [] 881 drop = [f for f in removed if f in m1]
882 882 for f in drop:
883 for f in removed: 883 del m1[f]
884 if f in m1:
885 del m1[f]
886 removed1.append(f)
887 mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(), 884 mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(),
888 p2.manifestnode(), (new, removed1)) 885 p2.manifestnode(), (new, drop))
889 886
890 text = ctx.description() 887 text = ctx.description()
891 lines = [line.rstrip() for line in text.rstrip().splitlines()] 888 lines = [line.rstrip() for line in text.rstrip().splitlines()]
892 while lines and not lines[0]: 889 while lines and not lines[0]:
893 del lines[0] 890 del lines[0]