610 def new(self, repo, patch, *pats, **opts): |
610 def new(self, repo, patch, *pats, **opts): |
611 msg = opts.get('msg') |
611 msg = opts.get('msg') |
612 force = opts.get('force') |
612 force = opts.get('force') |
613 user = opts.get('user') |
613 user = opts.get('user') |
614 date = opts.get('date') |
614 date = opts.get('date') |
|
615 if date: |
|
616 date = util.parsedate(date) |
615 self.check_reserved_name(patch) |
617 self.check_reserved_name(patch) |
616 if os.path.exists(self.join(patch)): |
618 if os.path.exists(self.join(patch)): |
617 raise util.Abort(_('patch "%s" already exists') % patch) |
619 raise util.Abort(_('patch "%s" already exists') % patch) |
618 if opts.get('include') or opts.get('exclude') or pats: |
620 if opts.get('include') or opts.get('exclude') or pats: |
619 fns, match, anypats = cmdutil.matchpats(repo, pats, opts) |
621 fns, match, anypats = cmdutil.matchpats(repo, pats, opts) |
638 p = self.opener(patch, "w") |
640 p = self.opener(patch, "w") |
639 if date: |
641 if date: |
640 p.write("# HG changeset patch\n") |
642 p.write("# HG changeset patch\n") |
641 if user: |
643 if user: |
642 p.write("# User " + user + "\n") |
644 p.write("# User " + user + "\n") |
643 p.write("# Date " + date + "\n") |
645 p.write("# Date %d %d\n" % date) |
644 p.write("\n") |
646 p.write("\n") |
645 elif user: |
647 elif user: |
646 p.write("From: " + user + "\n") |
648 p.write("From: " + user + "\n") |
647 p.write("\n") |
649 p.write("\n") |
648 if msg: |
650 if msg: |
933 |
935 |
934 def refresh(self, repo, pats=None, **opts): |
936 def refresh(self, repo, pats=None, **opts): |
935 if len(self.applied) == 0: |
937 if len(self.applied) == 0: |
936 self.ui.write("No patches applied\n") |
938 self.ui.write("No patches applied\n") |
937 return 1 |
939 return 1 |
|
940 newdate = opts.get('date') |
|
941 if newdate: |
|
942 newdate = '%d %d' % util.parsedate(newdate) |
938 wlock = repo.wlock() |
943 wlock = repo.wlock() |
939 try: |
944 try: |
940 self.check_toppatch(repo) |
945 self.check_toppatch(repo) |
941 (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) |
946 (top, patchfn) = (self.applied[-1].rev, self.applied[-1].name) |
942 top = revlog.bin(top) |
947 top = revlog.bin(top) |
993 comments.insert(patchheaderat + 1,'# User ' + newuser) |
998 comments.insert(patchheaderat + 1,'# User ' + newuser) |
994 except ValueError: |
999 except ValueError: |
995 comments = ['From: ' + newuser, ''] + comments |
1000 comments = ['From: ' + newuser, ''] + comments |
996 user = newuser |
1001 user = newuser |
997 |
1002 |
998 newdate = opts.get('date') |
|
999 if newdate: |
1003 if newdate: |
1000 if setheaderfield(comments, ['# Date '], newdate): |
1004 if setheaderfield(comments, ['# Date '], newdate): |
1001 date = newdate |
1005 date = newdate |
1002 |
1006 |
1003 if msg: |
1007 if msg: |