3732 os.path.isfile, glob.glob(repo.vfs.join(b"strip-backup") + b"/*.hg") |
3732 os.path.isfile, glob.glob(repo.vfs.join(b"strip-backup") + b"/*.hg") |
3733 ) |
3733 ) |
3734 ) |
3734 ) |
3735 backups.sort(key=lambda x: os.path.getmtime(x), reverse=True) |
3735 backups.sort(key=lambda x: os.path.getmtime(x), reverse=True) |
3736 |
3736 |
3737 opts = pycompat.byteskwargs(opts) |
3737 opts["bundle"] = b"" |
3738 opts[b"bundle"] = b"" |
3738 opts["force"] = None |
3739 opts[b"force"] = None |
3739 limit = logcmdutil.getlimit(pycompat.byteskwargs(opts)) |
3740 limit = logcmdutil.getlimit(opts) |
|
3741 |
3740 |
3742 def display(other, chlist, displayer): |
3741 def display(other, chlist, displayer): |
3743 if opts.get(b"newest_first"): |
3742 if opts.get("newest_first"): |
3744 chlist.reverse() |
3743 chlist.reverse() |
3745 count = 0 |
3744 count = 0 |
3746 for n in chlist: |
3745 for n in chlist: |
3747 if limit is not None and count >= limit: |
3746 if limit is not None and count >= limit: |
3748 break |
3747 break |
3749 parents = [ |
3748 parents = [ |
3750 True for p in other.changelog.parents(n) if p != repo.nullid |
3749 True for p in other.changelog.parents(n) if p != repo.nullid |
3751 ] |
3750 ] |
3752 if opts.get(b"no_merges") and len(parents) == 2: |
3751 if opts.get("no_merges") and len(parents) == 2: |
3753 continue |
3752 continue |
3754 count += 1 |
3753 count += 1 |
3755 displayer.show(other[n]) |
3754 displayer.show(other[n]) |
3756 |
3755 |
3757 recovernode = opts.get(b"recover") |
3756 recovernode = opts.get("recover") |
3758 if recovernode: |
3757 if recovernode: |
3759 if scmutil.isrevsymbol(repo, recovernode): |
3758 if scmutil.isrevsymbol(repo, recovernode): |
3760 ui.warn(_(b"%s already exists in the repo\n") % recovernode) |
3759 ui.warn(_(b"%s already exists in the repo\n") % recovernode) |
3761 return |
3760 return |
3762 elif backups: |
3761 elif backups: |
3776 b'debugbackupbundle', |
3775 b'debugbackupbundle', |
3777 ui, |
3776 ui, |
3778 source, |
3777 source, |
3779 ) |
3778 ) |
3780 try: |
3779 try: |
3781 other = hg.peer(repo, opts, path) |
3780 other = hg.peer(repo, pycompat.byteskwargs(opts), path) |
3782 except error.LookupError as ex: |
3781 except error.LookupError as ex: |
3783 msg = _(b"\nwarning: unable to open bundle %s") % path.loc |
3782 msg = _(b"\nwarning: unable to open bundle %s") % path.loc |
3784 hint = _(b"\n(missing parent rev %s)\n") % short(ex.name) |
3783 hint = _(b"\n(missing parent rev %s)\n") % short(ex.name) |
3785 ui.warn(msg, hint=hint) |
3784 ui.warn(msg, hint=hint) |
3786 continue |
3785 continue |
3787 branches = (path.branch, opts.get(b'branch', [])) |
3786 branches = (path.branch, opts.get('branch', [])) |
3788 revs, checkout = hg.addbranchrevs( |
3787 revs, checkout = hg.addbranchrevs( |
3789 repo, other, branches, opts.get(b"rev") |
3788 repo, other, branches, opts.get("rev") |
3790 ) |
3789 ) |
3791 |
3790 |
3792 if revs: |
3791 if revs: |
3793 revs = [other.lookup(rev) for rev in revs] |
3792 revs = [other.lookup(rev) for rev in revs] |
3794 |
3793 |
3795 with ui.silent(): |
3794 with ui.silent(): |
3796 try: |
3795 try: |
3797 other, chlist, cleanupfn = bundlerepo.getremotechanges( |
3796 other, chlist, cleanupfn = bundlerepo.getremotechanges( |
3798 ui, repo, other, revs, opts[b"bundle"], opts[b"force"] |
3797 ui, repo, other, revs, opts["bundle"], opts["force"] |
3799 ) |
3798 ) |
3800 except error.LookupError: |
3799 except error.LookupError: |
3801 continue |
3800 continue |
3802 |
3801 |
3803 try: |
3802 try: |
3830 ui.status(b"\n%s\n" % (backupdate.ljust(50))) |
3829 ui.status(b"\n%s\n" % (backupdate.ljust(50))) |
3831 if ui.verbose: |
3830 if ui.verbose: |
3832 ui.status(b"%s%s\n" % (b"bundle:".ljust(13), path.loc)) |
3831 ui.status(b"%s%s\n" % (b"bundle:".ljust(13), path.loc)) |
3833 else: |
3832 else: |
3834 opts[ |
3833 opts[ |
3835 b"template" |
3834 "template" |
3836 ] = b"{label('status.modified', node|short)} {desc|firstline}\n" |
3835 ] = b"{label('status.modified', node|short)} {desc|firstline}\n" |
3837 displayer = logcmdutil.changesetdisplayer( |
3836 displayer = logcmdutil.changesetdisplayer( |
3838 ui, other, opts, False |
3837 ui, other, pycompat.byteskwargs(opts), False |
3839 ) |
3838 ) |
3840 display(other, chlist, displayer) |
3839 display(other, chlist, displayer) |
3841 displayer.close() |
3840 displayer.close() |
3842 finally: |
3841 finally: |
3843 cleanupfn() |
3842 cleanupfn() |