From: Eric S. Raymond Date: Sat, 15 Nov 2014 20:43:17 +0000 (-0500) Subject: Implementation and basic regression test for branch delete. X-Git-Tag: 0.9~21 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=ee8dba7a15e525f42efa14b5b9842b31a659b9c3;p=src.git Implementation and basic regression test for branch delete. --- diff --git a/TODO b/TODO index 450958a..c9c8582 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,5 @@ SRC TODO list -* src branch delete. Should branch_delete really obsolesce branches or just - mark them dead? - * should be possible to range-restict a tag or branch listing. * break up the tag and branch commands - separate delete/list/rename. diff --git a/src b/src index 6dacd5b..1ed78a2 100755 --- a/src +++ b/src @@ -102,9 +102,9 @@ def do_or_die(dcmd, legend=b"", loud=False): try: retcode = subprocess.call("(" + dcmd + ")" + mute, shell=True) if retcode < 0: - croak(b"child was terminated by signal %d." % -retcode) + croak(b"%s was terminated by signal %d." % (dcmd, -retcode)) elif retcode != 0: - croak(b"child returned %d." % retcode) + croak(b"%s returned %d." % (dcmd, retcode)) except (OSError, IOError) as e: croak(b"execution of %s%s failed: %s" % (dcmd, legend, e)) @@ -264,7 +264,7 @@ intro -- Basic concepts: commits, tags, branches. The form of commands. revisions -- How to specify ranges of commits to operate on. commands -- a summary of the commands. commit -- the commit comand: how to commit changes to a file. -amend -- the amend commant: editing stored change comments. +amend -- the amend command: editing stored change comments. status -- the status command: more details and unusual status codes ignores -- .srcignore files and their uses. """, @@ -684,7 +684,7 @@ class CommandContext: if type(part) == type(0): return part if part not in metadata.symbols: - croak("in {0}, can't resolve symbol {0}".format(metadata.name,token)) + croak("in {0}, can't resolve symbol {1}".format(metadata.name,token)) else: part = metadata.symbols[part] if backend.isbranch(part): @@ -1398,14 +1398,14 @@ class RCS: # What we need do is find the branch tip, then walk back to # just after the first point where it joins another branch, # then do a delete to end of branch from there. - base = metadata.branch_to_tip(branchname) + base = self.branch_to_tip(metadata.symbols[branchname], metadata) while True: if base is not None and metadata.by_native_d[base].branches: break else: base = self.pred(base) - do_or_die("rcs -o{0}: {1}".format(self.succ(base), arg)) - self.delete_tag(branchname, metadata.name) + do_or_die("rcs -o{0}: {1}".format(self.succ(base), metadata.name)) + self.delete_tag(branchname, metadata) def set_branch(self, name, revision, metadata): "Set the specified branch to be default, creating it if required." if name in metadata.symbols: diff --git a/srctest b/srctest index 586b9ff..b20bb73 100755 --- a/srctest +++ b/srctest @@ -248,12 +248,12 @@ head 1.4; branch 1.3.1.4.1; access; symbols - BLARGH:1.4 + GLARB:1.4 GORP:1.3.1.4 sample:1.3.1.4.0.1 muggle:1.3.0.1; locks - esr:1.3.1.4; + esr:1.3.1.4.1.5; comment @# @; expand @b@; @@ -296,6 +296,32 @@ next 1.3.1.4; 1.3.1.4 date 2014.11.12.03.36.45; author esr; state Exp; +branches + 1.3.1.4.1.1; +next ; + +1.3.1.4.1.1 +date 2014.11.13.04.04.55; author esr; state Exp; +branches; +next 1.3.1.4.1.2; + +1.3.1.4.1.2 +date 2014.11.13.04.23.04; author esr; state Exp; +branches; +next 1.3.1.4.1.3; + +1.3.1.4.1.3 +date 2014.11.13.04.26.23; author esr; state Exp; +branches; +next 1.3.1.4.1.4; + +1.3.1.4.1.4 +date 2014.11.13.04.30.39; author esr; state Exp; +branches; +next 1.3.1.4.1.5; + +1.3.1.4.1.5 +date 2014.11.13.04.31.02; author esr; state Exp; branches; next ; @@ -327,7 +353,7 @@ text 1.3.1.1 log -@On a branch 2? +@Totally unfubared. @ text @a3 2 @@ -338,7 +364,7 @@ Again, this should be branch text. 1.3.1.2 log -@Let's see if this commend has a sepaeator before it. +@Still utterly fubar @ text @d5 1 @@ -360,7 +386,7 @@ Revision 7. 1.3.1.4 log -@foo-bar +@Utterly fubar @ text @d4 4 @@ -370,6 +396,58 @@ Try a comment with a hyphen. @ +1.3.1.4.1.1 +log +@All fixed up. +@ +text +@a5 1 +Test of commit comments. +@ + + +1.3.1.4.1.2 +log +@It' all good. +@ +text +@a6 1 +Glotch. +@ + + +1.3.1.4.1.3 +log +@No good. +@ +text +@a7 1 +Random modification. +@ + + +1.3.1.4.1.4 +log +@That's good. +@ +text +@a4 1 +jjjj +d7 1 +@ + + +1.3.1.4.1.5 +log +@I see you +@ +text +@d5 1 +a5 1 +jjjjjjjjkkk +@ + + 1.2 log @Second comment. @@ -391,10 +469,10 @@ EOF cat >sample.seqlog <sample.branchlog <tryit +diff -u tryit sample.branchlog +check "traversal by .." + cat >sample.taglog <tryit -diff -u tryit sample.branchlog -check "traversal by .." - -src $TESTOPTS list @BLARGH sample >tryit +src $TESTOPTS list @GLARB sample >tryit diff -u tryit sample.taglog check "named-tag lookup with @" -src $TESTOPTS tag -r BLARGH GROTTY sample +src $TESTOPTS tag -r GLARB GROTTY sample check "tag renaming" cat >changes <tryit diff -u statuslog tryit check "status after ignore" +src $TESTOPTS branch delete GORP sample +check "branch delete" + +cat >newlist <tryit +diff -u newlist tryit +check "branch list check after delete" delete + +cat >newlog <tryit +diff -u newlog tryit +check "content after branch deletion" + rm -fr $SANDBOX # end