Mechiel Lukkien committed 1ccd756 Draft

hg/update: update to branch head when no args specified, refuse update while in merge without -C.

Comments (0)

Files changed (2)

 # todo
-- hg/update: should update to the branch tip, not the repo tip.
-- hg/update: should fail to update without -C when there are two
-  parents, or for cross-branch update (unless the target name specified
-  was the branch?)
 - hg/status (and others probably): fix handling of paths, e.g.
   "hg/status" in dir1/ should list all changes in the repo, "hg/status ."
   in dir1/ should list only those in dir1/.
 - hg/verify: verify that list of modified files in changelog entry
   matches with the files changed in the manifest.
+- hg/pull: more verification that received data is correct.
 - read up on all the formats.  dirstate, undo.dirstate undo.branch
   (for rollback), journal.dirstate, journal.branch, wlock;  lock,
   journal, fncache, etc.;


 	args = arg->argv();
 	if(len args > 1)
-	revstr := "tip";
+	revstr: string;
 	if(len args == 1)
 		revstr = hd args;
 	repo = Repo.xfind(hgpath);
 	ds := hg->xdirstate(repo, 0);
+	if(revstr == nil)
+		revstr = repo.xworkbranch();
+	if(ds.p1 != hg->nullnode && ds.p2 != hg->nullnode && !Cflag)
+		error("in merge, refusing to update without -C");
-	# xxx do special things when two parents are present (i.e. we were merging)?
 	onodeid := ds.p1;
 	(orev, nil) := repo.xlookup(onodeid, 1);
 	say(sprint("current rev %d nodeid %q", orev, onodeid));