Show More
@@ -862,7 +862,7 b' def bundle(ui, repo, fname, dest="defaul' | |||
|
862 | 862 | """ |
|
863 | 863 | dest = ui.expandpath(dest) |
|
864 | 864 | other = hg.repository(ui, dest) |
|
865 | o = repo.findoutgoing(other) | |
|
865 | o = repo.findoutgoing(other, force=opts['force']) | |
|
866 | 866 | cg = repo.changegroup(o, 'bundle') |
|
867 | 867 | write_bundle(cg, fname) |
|
868 | 868 | |
@@ -1766,7 +1766,7 b' def incoming(ui, repo, source="default",' | |||
|
1766 | 1766 | """ |
|
1767 | 1767 | source = ui.expandpath(source) |
|
1768 | 1768 | other = hg.repository(ui, source) |
|
1769 | incoming = repo.findincoming(other) | |
|
1769 | incoming = repo.findincoming(other, force=opts["force"]) | |
|
1770 | 1770 | if not incoming: |
|
1771 | 1771 | return |
|
1772 | 1772 | |
@@ -1978,7 +1978,7 b' def outgoing(ui, repo, dest="default-pus' | |||
|
1978 | 1978 | """ |
|
1979 | 1979 | dest = ui.expandpath(dest) |
|
1980 | 1980 | other = hg.repository(ui, dest) |
|
1981 | o = repo.findoutgoing(other) | |
|
1981 | o = repo.findoutgoing(other, force=opts['force']) | |
|
1982 | 1982 | o = repo.changelog.nodesbetween(o)[0] |
|
1983 | 1983 | if opts['newest_first']: |
|
1984 | 1984 | o.reverse() |
@@ -2066,7 +2066,7 b' def pull(ui, repo, source="default", **o' | |||
|
2066 | 2066 | raise util.Abort(_("pull -r doesn't work for remote repositories yet")) |
|
2067 | 2067 | elif opts['rev']: |
|
2068 | 2068 | revs = [other.lookup(rev) for rev in opts['rev']] |
|
2069 | r = repo.pull(other, heads=revs) | |
|
2069 | r = repo.pull(other, heads=revs, force=opts['force']) | |
|
2070 | 2070 | if not r: |
|
2071 | 2071 | if opts['update']: |
|
2072 | 2072 | return update(ui, repo) |
@@ -2646,7 +2646,8 b' table = {' | |||
|
2646 | 2646 | _('hg annotate [-r REV] [-a] [-u] [-d] [-n] [-c] FILE...')), |
|
2647 | 2647 | "bundle": |
|
2648 | 2648 | (bundle, |
|
2649 | [], | |
|
2649 | [('f', 'force', None, | |
|
2650 | _('run even when remote repository is unrelated'))], | |
|
2650 | 2651 | _('hg bundle FILE DEST')), |
|
2651 | 2652 | "cat": |
|
2652 | 2653 | (cat, |
@@ -2757,6 +2758,8 b' table = {' | |||
|
2757 | 2758 | _('hg import [-p NUM] [-b BASE] [-f] PATCH...')), |
|
2758 | 2759 | "incoming|in": (incoming, |
|
2759 | 2760 | [('M', 'no-merges', None, _('do not show merges')), |
|
2761 | ('f', 'force', None, | |
|
2762 | _('run even when remote repository is unrelated')), | |
|
2760 | 2763 | ('', 'style', '', _('display using template map file')), |
|
2761 | 2764 | ('n', 'newest-first', None, _('show newest record first')), |
|
2762 | 2765 | ('', 'bundle', '', _('file to store the bundles into')), |
@@ -2791,6 +2794,8 b' table = {' | |||
|
2791 | 2794 | "manifest": (manifest, [], _('hg manifest [REV]')), |
|
2792 | 2795 | "outgoing|out": (outgoing, |
|
2793 | 2796 | [('M', 'no-merges', None, _('do not show merges')), |
|
2797 | ('f', 'force', None, | |
|
2798 | _('run even when remote repository is unrelated')), | |
|
2794 | 2799 | ('p', 'patch', None, _('show patch')), |
|
2795 | 2800 | ('', 'style', '', _('display using template map file')), |
|
2796 | 2801 | ('n', 'newest-first', None, _('show newest record first')), |
@@ -2808,6 +2813,8 b' table = {' | |||
|
2808 | 2813 | [('u', 'update', None, |
|
2809 | 2814 | _('update the working directory to tip after pull')), |
|
2810 | 2815 | ('e', 'ssh', '', _('specify ssh command to use')), |
|
2816 | ('f', 'force', None, | |
|
2817 | _('run even when remote repository is unrelated')), | |
|
2811 | 2818 | ('r', 'rev', [], _('a specific revision you would like to pull')), |
|
2812 | 2819 | ('', 'remotecmd', '', |
|
2813 | 2820 | _('specify hg command to run on the remote side'))], |
@@ -785,7 +785,7 b' class localrepository(object):' | |||
|
785 | 785 | |
|
786 | 786 | return r |
|
787 | 787 | |
|
788 | def findincoming(self, remote, base=None, heads=None): | |
|
788 | def findincoming(self, remote, base=None, heads=None, force=False): | |
|
789 | 789 | m = self.changelog.nodemap |
|
790 | 790 | search = [] |
|
791 | 791 | fetch = {} |
@@ -898,7 +898,10 b' class localrepository(object):' | |||
|
898 | 898 | raise repo.RepoError(_("already have changeset ") + short(f[:4])) |
|
899 | 899 | |
|
900 | 900 | if base.keys() == [nullid]: |
|
901 | self.ui.warn(_("warning: pulling from an unrelated repository!\n")) | |
|
901 | if force: | |
|
902 | self.ui.warn(_("warning: repository is unrelated\n")) | |
|
903 | else: | |
|
904 | raise util.Abort(_("repository is unrelated")) | |
|
902 | 905 | |
|
903 | 906 | self.ui.note(_("found new changesets starting at ") + |
|
904 | 907 | " ".join([short(f) for f in fetch]) + "\n") |
@@ -907,10 +910,10 b' class localrepository(object):' | |||
|
907 | 910 | |
|
908 | 911 | return fetch.keys() |
|
909 | 912 | |
|
910 | def findoutgoing(self, remote, base=None, heads=None): | |
|
913 | def findoutgoing(self, remote, base=None, heads=None, force=False): | |
|
911 | 914 | if base == None: |
|
912 | 915 | base = {} |
|
913 | self.findincoming(remote, base, heads) | |
|
916 | self.findincoming(remote, base, heads, force=force) | |
|
914 | 917 | |
|
915 | 918 | self.ui.debug(_("common changesets up to ") |
|
916 | 919 | + " ".join(map(short, base.keys())) + "\n") |
@@ -937,7 +940,7 b' class localrepository(object):' | |||
|
937 | 940 | # this is the set of all roots we have to push |
|
938 | 941 | return subset |
|
939 | 942 | |
|
940 | def pull(self, remote, heads=None): | |
|
943 | def pull(self, remote, heads=None, force=False): | |
|
941 | 944 | l = self.lock() |
|
942 | 945 | |
|
943 | 946 | # if we have an empty repo, fetch everything |
@@ -945,7 +948,7 b' class localrepository(object):' | |||
|
945 | 948 | self.ui.status(_("requesting all changes\n")) |
|
946 | 949 | fetch = [nullid] |
|
947 | 950 | else: |
|
948 | fetch = self.findincoming(remote) | |
|
951 | fetch = self.findincoming(remote, force=force) | |
|
949 | 952 | |
|
950 | 953 | if not fetch: |
|
951 | 954 | self.ui.status(_("no changes found\n")) |
@@ -962,7 +965,7 b' class localrepository(object):' | |||
|
962 | 965 | |
|
963 | 966 | base = {} |
|
964 | 967 | heads = remote.heads() |
|
965 | inc = self.findincoming(remote, base, heads) | |
|
968 | inc = self.findincoming(remote, base, heads, force=force) | |
|
966 | 969 | if not force and inc: |
|
967 | 970 | self.ui.warn(_("abort: unsynced remote changes!\n")) |
|
968 | 971 | self.ui.status(_("(did you forget to sync? use push -f to force)\n")) |
General Comments 0
You need to be logged in to leave comments.
Login now